heroku部署被破坏,操作错误

时间:2015-04-25 13:58:12

标签: python django heroku web-deployment operationalerror

我在部署到heroku(在我的网络浏览器中)后收到错误消息:

OperationalError at /accounts/register/
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?

settings.py我有:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'mydata',
    'USER': [a name],
    'PASSWORD': [a password],
    'HOST': '127.0.0.1',
    'PORT': '5432',
    }
}

我在heroku日志中看到了一些抱怨:

2015-04-25T07:53:35.555555+00:00 heroku[router]: sock=client at=error code=H18 desc="Request Interrupted" method=GET path="/accounts/register/" host=myapp.herokuapp.com request_id=[long string] fwd="43.55.555.555" dyno=web.1 connect=1ms service=119ms status=503 bytes=13000

2015-04-25T07:56:49.555555+00:00 heroku[web.1]: State changed from up to starting
2015-04-25T07:56:52.555555+00:00 heroku[web.1]: Stopping all processes with SIGTERM

但在那之后它会做得更多。最后一系列消息以:

结尾
2015-04-25T13:30:06:555555+00:00 heroku[web.1]: State changed from starting to up

和6个摘要,状态为301404404292404404

我的wsgi.py未更改:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dating_site.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

我甚至在我的过程中添加了完整路径:

web: gunicorn mysite.wsgi --pythonpath ../mysite --log-file -

../mysite我在这里说的是主mysite目录w / settings.pywsgi.py和其他一些好东西。

当我访问myapponheroku/accounts的网页时,我得到一个漂亮的索引页面,但当我点击“注册”时,我在条目的顶部出现错误...真的让我感到困惑的是什么? accounts/login呈现一个需要csrf_token的表单...它加载得很好! accounts/register呈现一个当然需要csrf的表单......它抱怨could not connect to server: Connection refused。有趣的是,如果您从页面顶部用accounts/register替换accounts/login,那么尝试使用我的测试用户名和密码实际登录登录页面会产生同样的错误('操作错误'yada yada)

什么能引起/解决这个奇怪的问题?谢谢django明星,

科迪

1 个答案:

答案 0 :(得分:1)

是的,每当你做出改变并希望在Heroku中看到它时,你需要做git push heroku master。只要你有一个外向更改集。

相关问题