We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
运行环境: Ubuntu18.04,按照README.md 中的步骤,尝试在本地运行,在第四步迁移数据库,执行 pipenv run python manage.py migrate 命令时发生报错,错误信息是: django.db.utils.OperationalError: unable to open database file 并且根目录下并没有像以往一样生成db.sqlite3文件,于是去查看 HelloDjango-blog-tutorial/blogproject/settings文件夹下的common.py文件,发现DATABASES设置如下:
README.md
pipenv run python manage.py migrate
django.db.utils.OperationalError: unable to open database file
db.sqlite3
HelloDjango-blog-tutorial/blogproject/settings
common.py
DATABASES
DATABASES = { 'default': { 'ENGINE' 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'database', 'db.sqlite3'), }
根据django官方文档:
NAME¶ 默认值:(''空字符串) 要使用的数据库的名称。对于SQLite,它是数据库文件的完整路径。指定路径时,即使在Windows(例如C:/homes/user/mysite/sqlite3.db)上,也始终使用正斜杠。
'NAME'指定了db.sqlite3文件的完整路径,但是克隆下来的项目根目录中并没有database这个文件夹,因此导致报错unable to open database file,在项目根目录下手动新建database文件夹后,问题解决。
'NAME'
database
unable to open database file
The text was updated successfully, but these errors were encountered:
今天也遇到了这个问题,解决后才看到这个帖子。
Sorry, something went wrong.
No branches or pull requests
运行环境: Ubuntu18.04,按照
README.md
中的步骤,尝试在本地运行,在第四步迁移数据库,执行pipenv run python manage.py migrate
命令时发生报错,错误信息是:
django.db.utils.OperationalError: unable to open database file
并且根目录下并没有像以往一样生成
db.sqlite3
文件,于是去查看HelloDjango-blog-tutorial/blogproject/settings
文件夹下的common.py
文件,发现DATABASES
设置如下:根据django官方文档:
'NAME'
指定了db.sqlite3
文件的完整路径,但是克隆下来的项目根目录中并没有database
这个文件夹,因此导致报错unable to open database file
,在项目根目录下手动新建database
文件夹后,问题解决。The text was updated successfully, but these errors were encountered: