7👍
It’s not a good idea to put your templates in your static
because files there will be readily available to the internet, and you probably don’t want to be exposing your raw back end to the world ;)
Try this file structure (note that I have moved the templates
directory):
/tryDjango
/src
/tryDjango
urls.py
setting.py
_init_.py
wsgi.py
/templates
home.html
/profiles
admin.py
models.py
_init_.py
tests.py
views.py
Django’s main template loader searches through the directories of each of the INSTALLED_APPS
, and uses the first template in a templates
folder that matches.
If you rely upon that (which I recommend), you will need to add 'tryDjango',
to your INSTALLED_APPS
.
Alternatively, the other default template loader will look in paths you have defined for templates
folders.
For that, you will need to add the full path to TEMPLATES['dirs']
in Django 1.8+ or TEMPLATE_DIRS
in older versions.
0👍
1) /templates
<your app name>folder
home.html
//this is must, create folder and give the name of app.
in my case,
/studydjango
/base
/templates
/base
home.html
/studydjango
/templates
2) def home(request):
return render(request, 'base/home.html, context) // path must given\
3) Include 'your app name' in INSTALLED_APPS