Hello! Thank you for this service. I have a Django application set up on PythonAnywhere, but am attempting to hook the database up to ElephantSQL. On my local machine, I am able to connect to the ElelphantSQL DB using the same .env as I have on PythonAnywhere. I am running with a paid "Hacker" account.
On PythonAnywhere, when I try to connect (python manage.py makemigrations) I get the following error:
(myvirtualenv) 18:53 ~/jambuddy/backend (main)$ python manage.py makemigrations
/home/dbajamteam/.virtualenvs/myvirtualenv/lib/python3.10/site-
packages/django/core/management/commands/makemigrations.py:143: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': connection to server at "<ELEPHANT SQL DB ADDRESS REDACTED>" (<IP REDACTED>), port <PORT REDACTED> failed:
Connection refused
Is the server running on that host and accepting TCP/IP connections?
warnings.warn(
No changes detected
Here is my settings.py:
import os
import environ
env = environ.Env()
environ.Env.read_env()
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = env('SECRET_KEY')
DEBUG = True
ALLOWED_HOSTS = ['0.0.0.0', 'localhost', 'dbajamteam.pythonanywhere.com']
INSTALLED_APPS = [
'rest_framework',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'jamrequestmodule',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"corsheaders.middleware.CorsMiddleware",
"django.middleware.common.CommonMiddleware",
]
INTERNAL_IPS = ['127.0.0.1']
ROOT_URLCONF = 'jamrequestmodule.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'jamrequestmodule.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': env('POSTGRES_USER'),
'USER': env('POSTGRES_USER'),
'PASSWORD': env('POSTGRES_PASSWORD'),
'HOST': env('POSTGRES_HOST'),
'PORT':'5432'
}
}
CORS_ORIGIN_WHITELIST = ['*']
Any ideas what I can do? ElephantSQL does not have any sort of whitelist settings that I can see from their admin panel.