Google App Engine Flexi上的Django的Postgres设置 [英] Postgres settings for Django on Google App Engine Flexi

查看:133
本文介绍了Google App Engine Flexi上的Django的Postgres设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我按照这里的说明操作: https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql -postgres



我的django设置:

  DATABASES = {
'default':{
'ENGINE':'django.db.backends.postgresql',
'NAME':'< db-name>',
'USER':'< user-name>',
'PASSWORD':'< password>',
'HOST':'/ cloudsql /< instanse-connection-name>
'PORT':'5432'
},
}

app.yaml:

  beta_settings:
cloud_sql_instances:< instanse-connection-name>

我得到的是:


无法连接到服务器:没有这样的文件或目录服务器
本地运行,并接受Unix域上的连接socket
/cloudsql/instanse-connection-name/.s .PGSQL.5432?


请帮助正确的设置。

解决方案

问题解决了。我的代码没有改变任何东西。以下是在应用引擎灵活环境中使用postgresql与django的步骤:



https://github.com/GoogleCloudPlatform/python-docs-samples/issues/870


I am trying to setup django with postgres on app engine flexi environment.

I followed the instructions from here: https://cloud.google.com/appengine/docs/flexible/python/using-cloud-sql-postgres

My django settings:

DATABASES = {
    'default': {
            'ENGINE': 'django.db.backends.postgresql',
            'NAME': '<db-name>',
            'USER': '<user-name>',
            'PASSWORD': '<password>',
            'HOST': '/cloudsql/<instanse-connection-name>,
            'PORT': '5432'
        },
}

app.yaml:

beta_settings:
    cloud_sql_instances: <instanse-connection-name>

Error I am getting is:

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

Please help with the correct settings.

解决方案

The problem resolved itself. I didn't change anything in my code. Here are the steps to use postgresql with django in app engine flexible environment:

https://github.com/GoogleCloudPlatform/python-docs-samples/issues/870

这篇关于Google App Engine Flexi上的Django的Postgres设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆