Search code examples
pythondjangoherokuweb-deploymentoperationalerror

heroku deployment busted, operational error


I am getting error message after deploying to heroku (in my web browser):

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?

In settings.py I have:

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

I see some whining in heroku logs of:

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

but it does more after that. The last series of messages ends with:

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

and 6 summaries, with statuses 301, 404, 404, 292, 404, 404

My wsgi.py is unchanged:

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

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

I even added the full path in my proc:

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

By ../mysite here I was saying the main mysite directory w/ settings.py, wsgi.py, and a few other goodies.

When I go to the webpage of myapponheroku/accounts I get a pretty index page, but when I click on "register" I get the error at the top of the entry...what really baffles me? accounts/login renders a form with a csrf_token required...it loads just fine! The accounts/register renders a form with of course csrf required...it grumbles about could not connect to server: Connection refused. Interestingly enough, attempting to actually login on the login page with my testing username and password yields literally the same error if you replace accounts/register with accounts/login from the top of the page ('operational error' yada yada)

What can cause/fix a problem this strange? Thank you django stars,

Cody


Solution

  • Yeah each time you make a change and want to see it live in Heroku you need to do git push heroku master. As long as you have an outgoing change set.