DATABASE_URL missing

Project id: 4f0fc161-46d1-43d8-8755-ed4c3ba94e92/service/bf2faa32-b938-49c1-b00a-0fa3b5b60384 I am deploying a Djano app. My Procfile is:
python manage.py migrate && gunicorn lynkster_backend.wsgi --timeout 600 --workers 4
python manage.py migrate && gunicorn lynkster_backend.wsgi --timeout 600 --workers 4
In my settings.py file I have:
DATABASES = {}
database_url = os.environ.get('DATABASE_URL')
if database_url:
DATABASES['default'] = dj_database_url.parse(database_url)

else:
DATABASES['default'] = {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'X',
'USER': 'X',
'HOST': 'localhost',
'PORT': '5432',
}
DATABASES = {}
database_url = os.environ.get('DATABASE_URL')
if database_url:
DATABASES['default'] = dj_database_url.parse(database_url)

else:
DATABASES['default'] = {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'X',
'USER': 'X',
'HOST': 'localhost',
'PORT': '5432',
}
The error I am getting is
Is the server running on that host and accepting TCP/IP connections?

connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused

Is the server running on that host and accepting TCP/IP connections?

Sentry is attempting to send 2 pending events

Waiting up to 2 seconds

Press Ctrl-C to quit
Is the server running on that host and accepting TCP/IP connections?

connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused

Is the server running on that host and accepting TCP/IP connections?

Sentry is attempting to send 2 pending events

Waiting up to 2 seconds

Press Ctrl-C to quit
In my app I have the DATABASE_URL var set but it looks like it is missing in this process. Ideas?
Solution:
I had to press the "deploy" button that shows up in the project pane
Jump to solution
5 Replies
Percy
Percy8mo ago
Project ID: 4f0fc161-46d1-43d8-8755-ed4c3ba94e92,bf2faa32-b938-49c1-b00a-0fa3b5b60384
slicksammy
slicksammy8mo ago
Locally running
python manage.py migrate && gunicorn lynkster_backend.wsgi --timeout 600 --workers 4
python manage.py migrate && gunicorn lynkster_backend.wsgi --timeout 600 --workers 4
Without specifying DATABASE_URL results in the same error Nvm, i guess the behavior for setting ENV vars changed. We're good
Brody
Brody8mo ago
what was the final solution?
Solution
slicksammy
slicksammy8mo ago
I had to press the "deploy" button that shows up in the project pane
Brody
Brody8mo ago
well yeah that would do it
Want results from more Discord servers?
Add your server