【发布时间】:2019-12-06 15:37:09
【问题描述】:
当我在 heroku 中运行我的服务器时,我收到以下错误消息:
Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
在我的 heroku 应用程序上,它说它确实添加了 Postgres db 插件。
数据库设置
DATABASES = {
'default': {}
}
try:
from .local_settings import LOCAL_DATABASE_SETTING
DATABASES['default'] = LOCAL_DATABASE_SETTING
except ImportError:
DATABASES['default'] = {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'heroku-postgresql',
}
【问题讨论】:
-
但是你配置 Django 来使用那个数据库了吗?如何?您使用的是 django-heroku 还是 dj-database-url?显示您的 DATABASES 设置。
-
是的,没错。 Heroku 不会为您提供本地数据库。见devcenter.heroku.com/articles/heroku-postgresql
标签: python django postgresql heroku