Google Cloud 및 Google App Engine을 사용하여 자사의 신제품을 평가하고 있습니다. 내가 대신 MySQL을의 포스트 그레스를 사용하는이 튜토리얼에 적응하기 위해 노력하고있어 : 내가 생산하려고 할 때 성공적으로 로컬 데이터베이스에 연결할 수있어 동안, 나는 500 오류를 다음 얻을Django를 Google App Engine의 Google CloudSQL Postgres 데이터베이스에 연결하는 중 오류가 발생했습니다.
https://cloud.google.com/python/django/flexible-environment
:
OperationalError at /admin/login/
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/cloudsql/<project_name_hidden>:us-central1:<database_id_hidden>/.s.PGSQL.5432"?
필자는 Postgres에 연결하기 위해 샘플 프로젝트를 세 번 변경했습니다.
beta_settings:
cloud_sql_instances: <project_name_hidden>:us-central1:<database_id_hidden>
내가 settings.py이 조각을 가지고 :
# [START dbconfig]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'polls',
'USER': '<db_user_name_hidden>',
'PASSWORD': '<db_password_hidden>',
'PORT': '5432',
}
}
# 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/<project_name_hidden>:us-central1:<database_id_hidden>'
if os.getenv('GAE_INSTANCE'):
pass
else:
DATABASES['default']['HOST'] = '127.0.0.1'
# [END dbconfig]
이 requirements.py이 : 나는 애플리케이션 제목의이 조각이
Django==1.10.6
#mysqlclient==1.3.10
psycopg2==2.7.1
wheel==0.29.0
gunicorn==19.7.0
같은 오류가 발생합니다. 해결책을 찾지 못했습니다. github에서 문제를 만들었습니다 : https://github.com/GoogleCloudPlatform/python-docs-samples/issues/870 –