django TemplateNotFound error
I have a template paste_form.html, but it doesn't get rendered.
<django.template.base.Template object at 0x1057c9710>
So it seems to exist somewhere. But according to the template loader post-mortem:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/templates/pastebin/paste_form.html (File does not exist)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/templates/pastebin/paste_form.html (File does not exist)
/Users/cole/PycharmProjects/djenproject/pastebin/templates/pastebin/paste_form.html (File does not exist)
My template dir is: '/Users/cole/PycharmProjects/djenproject/pastebin/templates'
Whether this dir is commented out or not, I still get TemplateNotFound errors.
Trying to figure out something:
'/Applications/PyCharm.app/helpers/pydev'
This kinda suprised me, but I'm nooby enough that surprise my actually indicate confusion.
How do I solve this problem?
Thanks, Cole
from django.template.loader import get_template
get_template('paste_form.html')
<django.template.base.Template object at 0x1057c9710>
So it seems to exist somewhere. But according to the template loader post-mortem:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/templates/pastebin/paste_form.html (File does not exist)
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/templates/pastebin/paste_form.html (File does not exist)
/Users/cole/PycharmProjects/djenproject/pastebin/templates/pastebin/paste_form.html (File does not exist)
My template dir is: '/Users/cole/PycharmProjects/djenproject/pastebin/templates'
Whether this dir is commented out or not, I still get TemplateNotFound errors.
Trying to figure out something:
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
ROOTDIR
'/Applications/PyCharm.app/helpers/pydev'
This kinda suprised me, but I'm nooby enough that surprise my actually indicate confusion.
How do I solve this problem?
Thanks, Cole
Please sign in to leave a comment.
/Users/cole/PycharmProjects/djenproject
This dir is the project root directory. I'm not sure where the Django server run configuration is though.
I run the project by using PyCharm to run the following task: manage.py runserver. The admin page works fine so runserver handles that particular piece just fine.
I have changed very little from the install settings, adding only a path to django:
file:///Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django (added by user)
I cannot seem to get PyCharm/Django to see my templates folder even though the template loader sees some object which corresponds to a template file.
Any suggestions