0
votes

I deployed a Django app to Google app engine flexible env, and it uses a Postgresql db from google cloud sql.

The website could be open, but if I refresh the page at a very short interval, then the website will fail with sometime error saying

Exception Value:    
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/cloudsql/[my-db-connection-name]/.s.PGSQL.5432"?

I wonder why could it fail? Does it mean Google app engine or cloud sql sucks? Should I switch to Heroku or AWS?

1
Are you initiating the connection to the database in proper way that is with in the context of your Django app? Otherwise I suggest you to go through this video that talks about configuring IPs for your Cloud Sql db youtube.com/watch?v=ZiJkEAfvFUc&t=430s - navule

1 Answers

1
votes

It looks like you are not connecting to your Cloud SQL Instance correctly. Make sure you are connecting from App Engine flexible environment to Cloud SQL following the instructions from this link [1].

If your instance has public IP address use this link [2] or if your instance has private IP address use this link [3] to configure connectivity for your Cloud SQL instance.

[1] https://cloud.google.com/sql/docs/postgres/connect-app-engine-flexible

[2] https://cloud.google.com/sql/docs/postgres/configure-ip

[3] https://cloud.google.com/sql/docs/postgres/configure-private-ip