我在heroku上用postgres设置了django,效果很好。但是,我想在本地开发,对于这个项目的本地开发来说,使用 sqlite 很好。
我添加了一个本地设置文件并将数据库设置更改回本地 sqlite。当我在本地加载站点时,出现以下错误:
OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
这是我的本地数据库设置:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'wagon_sql.sql3', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': '',
'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
我想我只是忘记了某个版本之类的步骤syncdb
……但是……不确定。关于如何让它发挥作用的任何想法?我还可以提供哪些其他信息来更清楚地说明这一点?
谢谢!
编辑
我想我要问的是,在更改DATABASE
设置后,除了重新启动服务器之外,我还需要运行任何命令吗?