使用乘客部署Django应用程序 [英] Deploying Django app using passenger

查看:152
本文介绍了使用乘客部署Django应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过他们的wiki上的所有东西 - 然后我迷路了。 http://wiki.dreamhost.com/Django



我有一个空白的Django模板,每当我尝试改变任何东西,我得到一个500内部服务器错误。



我已经在本地完全开发了我的django应用程序,只想在线上托管它 - 认为这将很容易,但慢慢地学习它不是。



我将我的应用程序视频上传到此目录,然后将其放入已安装的应用程序中,并运行python manage.py syncdb,找不到灯具(我发现奇数) / p>

从那里,它只是得到一个内部服务器错误。



这是我得到的错误: http://tweettune.com/ ,这里是错误日志:

  [Wed Aug 24 01:49:15 2011] [error] [client 66.212.30.122]脚本头的过早结束:
[Wed Aug 24 01:49:15 2011] [error] [client 66.212.30.122]脚本头的过早结束:internal_error.html
[Wed Aug 24 08:16:40 2011] [error] [client 99.229.160.94]脚本头的过早结束:
[ Wed Aug 24 08:16:41 2011] [error] [client 99.229.160.94]脚本头的过早结束:internal_error.html
[Wed Aug 24 08:21:38 2011] [error] [client 99.229.160.94]脚本头的过早结束:
[Wed Aug 24 08:21:38 2011] [error] [client 99.229。 160.94]脚本头的过早结束:internal_error.html
[Wed Aug 24 08:27:41 2011] [error] [client 99.229.160.94]脚本头的过早结束:
[Wed Aug 24 08 :27:41 2011] [error] [client 99.229.160.94]脚本头的过早结束:internal_error.html



我一直在尝试6个小时,不知道我做错了什么。我想我根本就不明白如何部署一个应用程序 - 我的想法过程现在是采取我本地托管的应用程序,并在线替换默认的django模板中的所有文件。我不明白为什么这不行,但不是。我在我的passenger_wdgi文件中使用了这个代码,我尝试过hello world app的例子。它的作用是...

  def application environ,start_response)
start_response('200 OK',[('Content-type','text / plain')])
return [Hello,world!]

任何方向都会有帮助。



编辑: 以下是我的passenger_wsgi.py文件的内容,可能有帮助(虽然它是由dreamhost自动生成的...所以认为这是正确的)。

  import sys,os 
sys.path.append(os.getcwd())
os.environ ['DJANGO_SETTINGS_MODULE'] =sotd.settings
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
project_path ='/ home / tweettune.com / sotd /'
sys .path.insert(1,project_path)


解决方案

同样的问题。
解决方案是将我的应用程序的文件夹添加到wsgi_passenger.py

  import sys,os 
sys.path.append(os.getcwd())
sys.path.append(os.path.join(os.getcwd(),'include your apps folder here'))
os。 environ ['DJANGO_SETTINGS_MODULE'] =cpc.settings
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

此链接对我非常有用:
http://discussion.dreamhost.com/thread-128918.html


I can get through everything on their wiki - and then I'm lost. http://wiki.dreamhost.com/Django

I have a blank Django template, and whenever I try to change anything I get a 500 internal server error.

I have completely developed my django app locally and just want to host it online - figured it would be easy but am slowly learning that it is not.

I upload my app "videos" to this directory and then put it into the installed apps and ran "python manage.py syncdb", which finds no fixtures (which I Found odd).

From there, it just gets an internal server error.

Here is the error I am getting: http://tweettune.com/ and here is the error log:

[Wed Aug 24 01:49:15 2011] [error] [client 66.212.30.122] Premature end of script headers:
[Wed Aug 24 01:49:15 2011] [error] [client 66.212.30.122] Premature end of script headers: internal_error.html
[Wed Aug 24 08:16:40 2011] [error] [client 99.229.160.94] Premature end of script headers:
[Wed Aug 24 08:16:41 2011] [error] [client 99.229.160.94] Premature end of script headers: internal_error.html
[Wed Aug 24 08:21:38 2011] [error] [client 99.229.160.94] Premature end of script headers:
[Wed Aug 24 08:21:38 2011] [error] [client 99.229.160.94] Premature end of script headers: internal_error.html
[Wed Aug 24 08:27:41 2011] [error] [client 99.229.160.94] Premature end of script headers:
[Wed Aug 24 08:27:41 2011] [error] [client 99.229.160.94] Premature end of script headers: internal_error.html

I've been trying for 6 hours now and can not figure out what I am doing wrong. I suppose I just don't understand how to deploy an application at all - my thought process now is take my locally hosted app and replace all the files in the default django template online. I don't see why this should not work but it's not. I tried the "hello world app" example by using this code in my passenger_wdgi file and it works...

def application(environ, start_response):
    start_response('200 OK', [('Content-type', 'text/plain')])
    return ["Hello, world!"]

Any direction would be helpful.

EDIT: Here are the contents of my passenger_wsgi.py file which may be helpful (although it is automatically generated by dreamhost...so figured it would be correct).

import sys, os
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = "sotd.settings"
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
project_path='/home/tweettune.com/sotd/'
sys.path.insert(1, project_path)

解决方案

I had the same problem. The solution was to add the folder of my application in the wsgi_passenger.py

import sys, os
sys.path.append(os.getcwd())
sys.path.append(os.path.join(os.getcwd(), 'include your apps folder here'))
os.environ['DJANGO_SETTINGS_MODULE'] = "cpc.settings"
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

This link was very useful to me: http://discussion.dreamhost.com/thread-128918.html

这篇关于使用乘客部署Django应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆