So I am Learning Django at in advanced level, I Already know how to include templates from BASE_DIR where manage.py is located. However I wanted to know how to locate templates in the specific app in Django.
For Example, I have a project named ‘mysite’ and an app called polls.
Now, I Added Templates in settings.py DIRS=[os.path.join(BASE_DIR, “templates”)].
but, how to add templates specific to polls app in polls app directory?
.
├── db.sqlite3
├── manage.py
├── mysite
│ ├── asgi.py
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── polls
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── migrations
│ │ ├── __init__.py
│ ├── models.py
│ ├── static
│ │ ├── images
│ │ ├── scripts.js
│ │ └── style.css
│ ├── tests.py
│ ├── urls.py
│ └── views.py
└── templates
├── polls
│ └── index.html
└── static
├── images
├── scripts.js
└── style.css
Before, I Wanted it to look like this.
.
├── db.sqlite3
├── manage.py
├── mysite
│ ├── asgi.py
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── polls
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── migrations
│ │ ├── __init__.py
│ ├── models.py
│ ├── static
│ │ ├── images
│ │ ├── scripts.js
│ │ └── style.css
│ ├── templates
│ │ ├── polls
│ | │ ├── index.html
│ ├── tests.py
│ ├── urls.py
│ └── views.py
└── templates
├── polls
│ └── index.html
└── static
├── images
├── scripts.js
└── style.css
Mohit Prajapat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.