Reputation: 807
edited the DATABASES entry in my settings.py to be:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'Limbo',
'USER': '<username>',
'PASSWORD': '<password>',
'HOST': '<dbname>.<gibberish>.us-west-2.rds.amazonaws.com',
'PORT': '5432',
}
}
now when I .manage.py runserver 0.0.0.0:800
, it says:
Performing system checks...
System check identified no issues (0 silenced).
then after a minute or two:
File "/home/ec2-user///local/lib64/python2.7/site-packages/psycopg2/init.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) django.db.utils.OperationalError: could not connect to server: Connection timed out Is the server running on host "..us-west-2.rds.amazonaws.com" (172.rest.of.ip) and accepting TCP/IP connections on port 5432?
I have made sure to include the access via 5432 incoming from my ec2's IP (verified with curl ifconfig.co
) and the ip listed in the error message (starting with 172 above). perhaps I need to use a larger subnet (than 32)in the 172 source?
EDIT: same error when I run python limbo/manage.py migrate
EDIT2: if I allow 5432 connections from any IP in the security group it works, but as stated above, I am allowing my EC2's IP (according to curl ifconfig.co
's return value. what other IP should I be including?
Upvotes: 1
Views: 318
Reputation: 807
enter the following into the linux command line:
cd /path/to/djangoproj
screen
source <env>/bin/activate
then you should see the command line tool reads something like:
(<env>)[ec2-user@ip-172-31-26-243 djangoproj]$
see that section in the middle: ip-172-31-26-243
, that's the local ip, use that in the security group settings. in this case, I used 172.31.26.243/32 as the incoming IP allowed
then try to runserver
again
Upvotes: 2