1👍
✅
import os
import sys
PORJECT_ROOT = os.path.join(os.path.dirname(__file__),'..')
sys.path.insert(0, os.path.join(PROJECT_ROOT,'static'))
0👍
Make sure that the folder is included in the TEMPLATE_DIRS
setting (in settings.py).
- [Answer]-Django redirect still allows post on reload only on mobile Chrome
- [Answer]-Python Django – Comparing an Array with a Model
- [Answer]-Django Templates: How to filter based on the URL?
0👍
Generally(by convention) template files folder is project_root_folder\templates folder, update TEMPLATE_DIRS in settings.py:
import os
PORJECT_ROOT = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = (
os.path.join(PORJECT_ROOT, 'templates'),
)
While static store only javascript/css/images fiels.
That will make future develop and deploy easier.
0👍
BY default django checks in app/templates directory for a template match, or in the project_root/templates/. You should have the directory listed in the TEMPLATE_DIRS setting as others have stated.
- [Answer]-Django Session with Memcached or ElastiCache, does the Django code need to be changed?
- [Answer]-Django doesn't load css files
- [Answer]-Invalid response of JSON data from Django QuerySet
- [Answer]-Can't find where an object method is defined (Askbot / Django)
Source:stackexchange.com