简体   繁体   English

带有sqlite的Django无法打开数据库文件

[英]django with sqlite unable to open database file

I have sqlite database setting like in my production server : 我在生产服务器中有sqlite数据库设置:

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}

} }

I have also tried chown www-data path_to_db and chmod 777 path_to_db 我也尝试过chown www-data path_to_dbchmod 777 path_to_db

I am using celery, rabbitmq and supervisor in this application.. but its still showing error saying unable to open database.. whats the issue here 我在此应用程序中使用celery,rabbitmq和超级用户..,但仍显示错误,提示无法打开数据库..这里的问题是什么

这为我工作:

chown www-data path_to_directory_containing_db

First lets find out the value of BASE_DIR. 首先让我们找出BASE_DIR的值。 Add to your settings.py 添加到您的settings.py

print "base dir %s" % BASE_DIR

And run server. 并运行服务器。 You'll see your base_dir and could ensure that file is in right place. 您将看到base_dir,并可以确保该文件在正确的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM