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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:15:46+00:00 2026-05-16T12:15:46+00:00

I started going through The Definitive Guide to Django and now would like to

  • 0

I started going through The Definitive Guide to Django and now would like to start working on my own project. I have Django set up and everything. I created a project called djangoproject1. Basically what I would like is that the main page is a registration/login page. My urls.py for djangoproject1 looks like this:

urlpatterns = patterns('',
    (r'^/',include('djangoproject1.authentication.urls')),
)

I have a pydev package (application) under djangoproject1 called authentication which has an urls.py that looks like this:

urlpatterns = patterns('',
    (r'^$',direct_to_template,{'template':'index.html'}),
)

A couple of questions:

  1. I’m getting a page not found error which means I’m probably doing my mapping/include incorrectly
  2. If I don’t specify anything under TEMPLATE_DIRS in settings.py, my understanding is that Django will look in each package for a directory named templates. Is that correct?
  • 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-16T12:15:46+00:00Added an answer on May 16, 2026 at 12:15 pm

    What Asinox has said is not true. You MAY have a global template directory, even several of them. But that is not a must.

    In fact template loading is done as follows:

    1. Django takes first class name from TEMPLATE_LOADERS settings variable
    2. It instantiates the template loader based on its name
    3. It tries to load the template using this instance
    4. If it succeeds – the template is returned
    5. If if fails to load the template – it takes the next name and starts over again from 2.
    6. If none of the template loaders listed in TEMPLATE_LOADERS managed to load the template TemplateDoesNotExist exception is raised

    By default TEMPLATE_LOADERS is set to

    TEMPLATE_LOADERS = (
        'django.template.loaders.filesystem.load_template_source',
        'django.template.loaders.app_directories.load_template_source',
    )
    

    As Matthew stated TEMPLATE_DIRS is used solely by filesystem.load_template_source loader. So if you exclude it from the list it won’t have any impact on template loading process at all.

    In order for your template to be found I’d suggest you to do the following:

    • Make your index.html namespaced, i.e. put it as follows:
    .
    `-- djangoproject1
        `-- authentication
            `-- templates
                `-- authentication
                    `-- index.html
    
    • Load the template namespaced:
    
        urlpatterns = patterns('',
            (r'^$', direct_to_template, {'template': 'authentication/index.html'}),
        )
    

    Unless you do so you cannot be sure that Django loads index.html from the authentication application.

    Consider the behavior of app_directories.load_template_source template loader.

    Pretend you have just defined two applications app1 and app2 (no other apps are defined) and asked to load template ‘path/to/template.html’.

    The loader will check the following paths in no particular order:

    • project_root/app1/templates/path/to/template.html
    • project_root/app2/templates/path/to/template.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic GWT Maven project going. I added SmartGWT and started playing
Going through the SproutCore Getting started tutorial and have a problem. Inside the Todos.todoListController
I have started going through the samples of the cURL, in C. While compiling
I am working on an eclipse RCP project. As I was going through the
I have planed to start using a framework in php development. After going through
I have started to learn jQuery and am going through some very simple examples
I recently learned scala and about to start working/learning Lift framework. Going through the
I have just started going through some tutorials of Powershell - for I want
Since the live() method is deprecated as of version 1.7, I started going through
I was going through Getting Started (with PostSharp ) And when I saw PostSharp

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.