Forums

PostgreSQL Database Connection Issues

Hello,

I am attempting to incorporate a PostgreSQL database in my Django web application. I am using Django 2.0 with Python 3.5. The error I am getting when I try to call 'python3 manage.py migrate' is

django.db.utils.OperationalError: could not connect to server: Connection timed out Is the server running on host "rlowman-738.postgres.pythonanywhere-services.com" (10.0.0.46) and accepting TCP/IP connections on port 10738?

The code I have in mysite.settings is

DATABASES = {
  'default': {
     'ENGINE' : 'django.db.backends.postgresql',
     'NAME' : 'myappdb',
     'USER' : 'myappuser',
     'PASSWORD' : '*correct password*',
     'HOST' : 'rlowman-738.postgres.pythonanywhere-services.com'
     'PORT' : 10738,
  }
}

I have weeded out all of the obvious errors such as wrong passwords/ usernames and obviously have bought the correct subscription to pythonanywhere to have access to PostgreSQL databases for my website. I have also followed the directions given at https://help.pythonanywhere.com/pages/PostgresGettingStarted/

closely on how to properly set up users for my database. Any suggestions on why this is happening?

Hi there -- sorry for the slow response! Your message got caught by an overactive spam filter.

Are you running the migration script inside PythonAnywhere? Or is it on your own local machine?