Django start project PYTHONPATH
So I have 3 django sites running on a development server.
2 of them work fine.
The third and last one unfortunately does not show the admin.
The error I get:
TemplateDoesNotExist at /admin/
Django tried loading these templates, in this order:
* Using loader django.template.loaders.filesystem.load_template_开发者_运维技巧source:
o /Users/Me/Documents/DJANGOSITES/TESTSITE/NEWSITES/NEWSITENAME/Template/admin/login.html (File does not exist)
* Using loader django.template.loaders.app_directories.load_template_source:
o /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/contrib/admindocs/templates/admin/login.html (File does not exist)
In my PYTHONPATH there are a lot of DIRs, BUT also the site-packages DIR (otherwise the other two wont work, right). My Django is in sitepackages, just if that is not clear.
I cant seem to find the error.
The only thing I changed in between those sites is add the directory /Users/Me/Documents/DJANGOSITES/ to the PYTHONPATH.
Any ideas why such an error can appear on one sites, but not the other ones?
The setting is exactly the same.
One more thing:
When I started the project, I cd to the dir the site is in now and:
python django-admin.py startproject mysite
That did NOT work. It gave me this error:
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python: can't open file 'django-admin.py': [Errno 2] No such file or directory
After that:
django-admin.py startproject mysite
worked very well.
Hope anybody has an idea!
Thanks.
Verify that the template html files have read permission
in this dir (varies slightly depending on your system):
/lib/pythonX.X/site-packages/django/conrtib/admin/templates/admin/
use the following command:
chmod +r *.html
You may also need to modify the permissions on additional files, but this will at least allow you to access the admin section of your site
Not sure how this would work in Windows. This seems to required be required in cygwin.
精彩评论