getting 500 internal server error with django on d

2019-08-15 08:10发布

问题:

so i'm not sure what exactly is going on here, i'm a bit of a newbie. so i'm going to walk you through what i've done so far.


i set up a django project using the automated dreamhost django setup script. then, following a tutorial, i created an app in the parent directory of my project, and then created a few models (names and etc are different than the actual tutorial models but that doesnt matter). they validated fine when i ran manage.py validate so i figure that means the syntax is fine and the tables were all created successfully when i ran syncdb. when i try interacting with them via the manage.py shell, it seems to work. i can create objects in the db and i can save them, delete them, view their values, whatever.

at this point, i tried out going to the server/admin and was able to get to and log into the admin page. cool! working!

i added my app to my project's INSTALLED_APPS array, restarted, and i get a 500 internal server error when trying to go to the admin page now.

i've tried rerunning syncdb because apparently you are supposed to do that after adding to installed_apps but i think i may have already done that. i'm not sure how to verify this.

also in my server logs i am getting the following:

[Fri Feb 11 18:07:13 2011] [error] [client 1**.**.**.142] Premature end of script headers: admin
[Fri Feb 11 18:07:13 2011] [error] [client 1**.**.**.142] Premature end of script headers: internal_error.html

回答1:

It sounds like your python path might be wrong. You placed your Django app(s) in the parent directory; that means your parent directory needs to be in your python path. If you're using mod_wsgi:

WSGIPythonPath /path/to/parent/dir:/path/to/parent/dir/YourProjectDir:/other/paths:

That's assuming /path/to/parent/dir is the parent directory and YourProjectDir is the project directory you chose.

If that's already configured, try running syncdb again. I just ran it on my DJano 1.2 site and it just told me which apps were synched. It didn't overwrite or destroy anything that was already created.



回答2:

recreated the whole setup and it works.

just some stupid server error. thanks guys!