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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:53:56+00:00 2026-06-03T11:53:56+00:00

I have the following folder structure for the templates on my django app: templates/

  • 0

I have the following folder structure for the templates on my django app:

templates/
   app/
      model1/
         model1_form.html
      model2/ 
         model2_form.html

Suppose I’m using model1 and a generic ListView, right now it only searches at templates/app/model1_form.html. Is there anyway I can tell django he should also search the app/ subfolders? I don’t want to have to set the template name and path manually (template_name="templates/app/model1/model1_form.html").

At settings.py I have:

import os.path
BASE_PATH = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = (
    BASE_PATH+'/templates/',
)

This is my view:

class HousesListView(ListView):
    model = House
    context_object_name = "house_list"

Thanks in advance!

  • 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-03T11:53:57+00:00Added an answer on June 3, 2026 at 11:53 am

    You need to add django.template.loaders.app_directories.Loader to TEMPLATE_LOADERS (if it’s not already).

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

    Then, change your folder structure such that you have a “templates” folder in the app directory:

    - <project_root>
        - app
            - templates
                - model1
                - model2
    

    Or to properly namespace the models so they don’t clash with other app names accidentally:

    - <project_root>
        - app
            - templates
                - app
                    - model1
                    - model2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following (desired) folder structure: *CommonProject *Project#1 ----> CommonProject(link) *Project#2 ---->
I am a newbie in this department.I have following folder structure root root\html root\html\html
I have the following structure in my assets folder of the app : -
I have the following directory structure of a project: Folder project in Eclipse: --folder
I have the following situation. My project has a main.scala.html file and a folder
I'm using eclipse. In the WEB-INF/lib folder I have the following jars. jstl-api-1.2.jar jstl-impl-1.2.jar
I have following folder structure: ProjectFolder/images/some images In the same folder ProjectFolder/WEB-INF/classes/com/xyz/here is java
I have got following folder structure for my domain (domain.com): /data/images (it´s subdomain name,
Trying to get a simple test perl script working. Have the following files/folder structure
Multilevel relative import I have following folder structure top\ __init__.py util\ __init__.py utiltest.py foo\

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.