heroku django Web服务器失败

heroku django Web服务器失败,django,heroku,procfile,Django,Heroku,Procfile,我将Procfile与web:python manage.py runserver'0.0.0:$PORT'一起使用,它第一次启动成功,但在第一次git push后崩溃,出现以下错误: OperationalError at / could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on

我将Procfile与
web:python manage.py runserver'0.0.0:$PORT'
一起使用,它第一次启动成功,但在第一次
git push
后崩溃,出现以下错误:

OperationalError at /

could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 5432?
重新启动webrunner没有帮助。有什么诀窍? heroku日志输出:

2013-11-25T23:39:56.725138+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
2013-11-25T23:39:56.725138+00:00 app[web.1]:     conn = _connect(dsn, connection_factory=connection_factory, async=async)
2013-11-25T23:39:56.725138+00:00 app[web.1]: OperationalError: could not connect to server: Connection refused
2013-11-25T23:39:56.725138+00:00 app[web.1]:    Is the server running on host "127.0.0.1" and accepting
2013-11-25T23:39:56.725138+00:00 app[web.1]:    TCP/IP connections on port 5432?
2013-11-25T23:39:56.725138+00:00 app[web.1]:     return Database.connect(**conn_params)
2013-11-25T23:39:56.725138+00:00 app[web.1]: 
2013-11-25T23:39:56.872620+00:00 app[web.1]: [26/Nov/2013 00:39:56] "GET / HTTP/1.1" 500 118846

使用gunicorn its表示找不到gunicorn应用程序和
app[web.1]:bash:gunicorn:command not found和heroku[router]:at=error code=H10 desc=“app crash”method=GET path=/host=scolled-falls-4631.herokuapp.com fwd=“188.163.187.182”dyno=connect=service=status=503字节=
来自heroku日志和heroku ps显示崩溃的应用程序[web]。使用djangos的runserver至少在第一次启动时启动。但是后来也崩溃了。

我不知道确切的原因,但是为什么你要在heroku上运行django的runserver?Heroku使用gunicorn,它可以执行project\u name/project\u name文件夹中的.wsgi文件

相反,在procfile中使用:“web:gunicorn recipe.wsgi”,以便gunicorn为您的django应用程序提供服务。只要我的2美分


此外,如果使用0.0.0.0:5432或127.0.0.1:5432,它可能会起作用

您的数据库未连接。确保您设置了正确的
数据库\u URL
环境变量,并且您确实有一个postgres计划处于活动状态。

谢谢@user2707389,它确实只适用于
requirements.txt
中声明的所有应用程序,但我不明白为什么它不适用于
-r
选项。无论如何,修复了进一步的Procfile并更正了wsgi.py,它就活了。

使用gunicorn its说找不到gunicorn应用程序和
app[web.1]:bash:gunicorn:command not found
heroku[router]:at=error code=H10 desc=“app crash”method=GET path=/host=scolled-falls-4631.herokapp.com fwd=“188.163.187.182”dyno=connect=service=status=503字节=
来自heroku日志和heroku ps显示崩溃的应用程序[web]。使用djangos的runserver至少在第一次启动时启动。如果你在heroku的网站上学习django on heroku教程,你会发现你必须创建requirements.txt文件,而gunicorn是一个必需的。比如说我的上一部作品,,requirements.txt有以下要求:Django==1.6 argparse==1.2.1 boto==2.16.0 Django ckeditor==4.0.2 Django注册==1.0 PIL==1.1.7 Pillow==2.2.1 South==0.8.2 static==0.4 dj数据库url==0.2.2.2 dj static==0.5 Django存储==1.1.8 gunicorn==18.0 psycopg2==2.5.1 wsgiref==0.2已经有<0.2代码>-核心文件夹的
requirements.txt
中的requirements/develope.txt。我想它应该像在本地机器上一样捕获它。奇怪的是,为什么它从requirements.txt安装只是为了明确声明其中的应用程序,而没有为
-r
这样做?你是否运行了
heroku插件:add heroku postgresql:dev
?设置了数据库URL,我不认为这是原因,因为上面说启动gunicorn失败了。但是谢谢你的回复。