/ Published in: Python
Hard-coding absolute paths is never ideal so here's a quick way to reference your project folder
Expand |
Embed | Plain Text
############################ #This can be dynamically obtained ############################ #TEMPLATE_DIRS +=('/Users/user_name/Desktop/django_project/templates/',) ############################ #With a little abspath magic ############################ import os.path PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) TEMPLATE_DIRS += (os.path.join(PROJECT_ROOT, "templates"),)
You need to login to post a comment.
