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 7506321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:13:31+00:00 2026-05-29T22:13:31+00:00

I am working on a django project which will contain several apps. Each app

  • 0

I am working on a django project which will contain several apps. Each app will have their own set of models and views.

Should each app also define their own url’s with a urls.py or maybe a function. What is the best practice for defining urls of apps within a django project, and integrating these urls with the main urls.py (root url conf) ?

  • 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-05-29T22:13:32+00:00Added an answer on May 29, 2026 at 10:13 pm

    It depends. If you’re dealing with a tiny website with one app, you can keep all the expressions in the same urls.py.

    However, when you’re dealing with a more complicated site with truly separate apps, I prefer the following structure:

    • myapp
      • admin.py
      • forms.py
      • models.py
      • urls.py
      • views.py
    • manage.py
    • settings.py
    • urls.py

    Don’t forget each folder needs it’s own __ init__.py

    # urls.py
    from django.conf.urls.defaults import *
    from django.contrib import admin
    
    admin.autodiscover()
    
    urlpatterns = patterns('',
        # Notice the expression does not end in $, 
        # that happens at the myapp/url.py level
        (r'^myapp/', include('myproject.myapp.urls')),
    )
    
    # myapp/urls.py
    from django.conf.urls.defaults import *
    
    urlpatterns = patterns('myproject.myapp.views',
        (r'^$', 'default_view',
        (r'^something/$', 'something_view',
    )
    

    You also may want to look at Class-based Generic Views

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

Sidebar

Related Questions

I have Django project on Dreamhost server which has several views that returns Json
Am working on an project in which I made an app core it will
In my project I have one app which have its own urls.py like this
I'm working on a small django project that will be deployed in a servlet
I have a django project that I have been working on as a solo
I have a django project, but for some reason basic jquery isn't working. <html>
I have a project that I am working on in django. There are a
I need to have an at-home project now that I'm working on Python/Django at
I'm working on a project, using Python/Django running on a Virtual Private Server, which
I am working on a GAE Django Project where I have to implementing the

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.