简体   繁体   English

在Dreamhost上使用django获取500个内部服务器错误

[英]getting 500 internal server error with django on dreamhost

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. 我使用自动dreamhost django设置脚本设置了django项目。 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. 当我运行manage.py validate时,它们验证的很好,所以我认为这意味着语法很好,并且当我运行syncdb时,所有表都已成功创建。 when i try interacting with them via the manage.py shell, it seems to work. 当我尝试通过manage.py shell与他们互动时,它似乎可以工作。 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. 我将应用程序添加到项目的INSTALLED_APPS数组中,重新启动,现在尝试进入管理页面时收到500个内部服务器错误。

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. 我已经尝试过重新运行syncdb,因为显然您应该在添加到installed_apps之后执行此操作,但是我认为我可能已经这样做了。 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

It sounds like your python path might be wrong. 听起来您的python路径可能有误。 You placed your Django app(s) in the parent directory; 您已将Django应用放置在父目录中; that means your parent directory needs to be in your python path. 这意味着您的父目录需要位于python路径中。 If you're using mod_wsgi: 如果您使用的是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. 假设/path/to/parent/dir是父目录,而YourProjectDir是您选择的项目目录。

If that's already configured, try running syncdb again. 如果已经配置,请尝试再次运行syncdb I just ran it on my DJano 1.2 site and it just told me which apps were synched. 我只是在DJano 1.2站点上运行了它,它只是告诉我同步了哪些应用程序。 It didn't overwrite or destroy anything that was already created. 它不会覆盖或破坏已经创建的任何内容。

recreated the whole setup and it works. 重新创建了整个设置,并且可以正常工作。

just some stupid server error. 只是一些愚蠢的服务器错误。 thanks guys! 多谢你们!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM