Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9144447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:16:19+00:00 2026-06-17T10:16:19+00:00

In Django, is it possible to have two different files with url patterns, neither

  • 0

In Django, is it possible to have two different files with url patterns, neither of which is called urls.py ? Or does Django rely on there being only one set of url patterns per Django app, and that it must be called urls.py ?

I’m using Django CMS and I want to split an app across two apphooks and two menus. So I’ve tried splitting urls.py into pub_urls.py and train_urls.py but I appear to have broken things by doing that, despite the cms_app.py naming the correct urls – eg:

from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
from resources.menu import TrainingMenu, PublicationMenu

class PublicationApp(CMSApp):
    name = _("Publication App") # give your app a name, this is required
    urls = ["resources.pub_urls"] # link your app to url configuration(s)
    menus = [PublicationMenu]

class TrainingApp(CMSApp):
    name = _("Training App") # give your app a name, this is required
    urls = ["resources.train_urls"] # link your app to url configuration(s)
    menus = [TrainingMenu]

apphook_pool.register(PublicationApp) # register your app
apphook_pool.register(TrainingApp) # register your app

Is something like this possible? Or do I have to split this into two different apps?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:16:20+00:00Added an answer on June 17, 2026 at 10:16 am

    There is nothing to stop your urls.py simply acting as a way of including multiple other urls files:

    urls.py:

    from django.conf.urls.defaults import patterns, include   
    urlpatterns = urlpatterns + patterns('',
                                             (r'^', include('pub_urls')),
                                             (r'^', include('train_urls')))
    

    pub_urls.py:

    from django.conf.urls.defaults import patterns, url
    
    urlpatterns = patterns('',
        (r'^$', 'homeview'),
        (r'^stuff/$', 'stuffview')
    )
    

    etc.

    ROOT_URLCONF in your settings file points to the root url file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is is possible to programatically join two tables using Django's ORM? I have two
I have two distinct Django projects, which I want to run on a single
I am using django and have urls such as the following in my url.py
Possible Duplicate: How do you select between two dates with Django I have django
I am wondering if it is possible to have the standard url patterns spread
In a django template, is it possible to have two (or more) dots after
Is it possible in django to have a ChoiceField on a formset level rather
Is it possible to customize a django application to have accept localized date format
I have two Django Projects where I use a lot of common models. Custom
Using Django 1.4 is it possible to have 2 apps within the same project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.