当我想使用postgresql时,为什么django使用sqlite3

时间:2014-09-06 10:38:05

标签: python django postgresql sqlite

当我尝试登录管理员时,我收到了这个愚蠢的错误。

Exception Type:
OperationalError 

Exception Value:
unable to open database file

Exception Location:
/usr/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py in get_new_connection, line 346 

问题是,为什么这甚至指的是sqlite ??

在我的设置中,我将数据库引擎指定为postgresql。

我尝试删除当前的数据库,让新的数据库执行全新的syncdb但没有成功。

---------使用设置进行编辑

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '',                      # Or path to database file if using sqlite3.
        # The following settings are not used with sqlite3:
        'USER': '',
        'PASSWORD': '',
        'HOST': 'localhost',                      # Empty for localhost through domain sockets or           '127.0.0.1' for localhost through TCP.
        'PORT': '',                      # Set to empty string for default.
    }
}

(名称,用户,pw已被取出)

1 个答案:

答案 0 :(得分:0)

你是使用Apache / nginx还是django的开发服务器以外的其他东西?一种可能的解释是您的服务器仍然引用旧的settings.py。

如果是这种情况,那么您还需要手动重启HTTP服务器。

相关问题