PostgreSQL
 SQL >> Datenbank >  >> RDS >> PostgreSQL

psycopg2 mit PostgreSQL auf Google App Engine verbinden

Für psycopg2 in Google App Engine Flexible Environments sind einige Konfigurationsschritte nötig. Zuerst wird die App mit dem Python-Quickstart bereitgestellt und dann mit Cloud SQL PostgreSQL verbunden.

In app.yaml den Cloud-SQL-Instanznamen eintragen:

beta_settings:
  cloud_sql_instances: PROJECT_NAME:INSTANCE_ZONE:INSTANCE_NAME=tcp:5432

psycopg2 in requirements.txt aufnehmen:

psycopg2
psycopg2-binary

Danach kann die App mit Host und Zugangsdaten eine Verbindung öffnen.