Currently I am trying to deploy a Django app on Google App Engine(GAE). All
goes well and app is deployed, but when it gets deployed, its connection
with Postgres instance lost. I don't know why this happening. following is
my *settings.py* file.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dbname',
'USER': 'username',
'PASSWORD': 'password',
}}# In the flexible environment, you connect to CloudSQL using a unix
socket.# Locally, you can use the CloudSQL proxy to proxy a localhost
connection# to the instance
DATABASES['default']['HOST'] = '/cloudsql/<instance-name>'if
os.getenv('GAE_INSTANCE'):
passelse:
DATABASES['default']['HOST'] = '100.107.126.241'
When i run it locally, it's making connection with google cloud Postgres as
i have given ipv4 address to make connection, but as soon as i deploy it on
*GAE*, following error comes while accessing database.
Is the server running locally and accepting connections on Unix domain
socket "/cloudsql/shopnroar-175407:us-central1:snr-instance1/.s.PGSQL.5432"?
here is my *app.yaml*
# [START runtime]
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT SNR.wsgi
env_variables:
# Replace user, password, database, and instance connection name with the
values obtained
# when configuring your Cloud SQL instance.
SQLALCHEMY_DATABASE_URI: >-
postgresql+psycopg2://user:password@/shopnroar?host=/cloudsql/<connection-name>
beta_settings:
cloud_sql_instances: shopnroar-175407:us-central1:snr-instance1
runtime_config:
python_version: 2# [END runtime]
Can anybody help me in this regard. i am stuck here for previous two days. i
was working on heroku before it. i am new here. i love to work with google but
this error has stuck me here for two days.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/abc448cf-a4ca-472e-b75c-4c3f45260481%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.