gpt4 book ai didi

django - 为 Django 教程同步 sqlite3

转载 作者:行者123 更新时间:2023-12-03 18:38:14 25 4
gpt4 key购买 nike

我正在启动 Django 教程并安装了虚拟环境和 django。我正在使用已经安装 sqlite3 的 Mac 10.6.8。

我在虚拟环境中工作。我将 settings.py 文件更改为:

ENGINE -- 'django.db.backends.sqlite3'

我离开了 NAME -- 在 settings.py 文件中空白(即 '' )因为教程说

"If the file doesn't exist, it will automatically be created when you synchronize the database for the first time."



但是当我运行 python manage.py syncdb ,我收到以下错误:

django.core.exceptions.ImproperlyConfigured: Please fill out the database NAME in the settings module before using the database.



为什么我的文件没有自动创建?或者我需要做什么来解决这个问题?

谢谢!

最佳答案

它将为您创建,但是 you have to specify what name to call it所以只需设置NAMEsqlite.db或类似的东西。您还可以指定一个路径,这样它就不会阻塞您的项目目录。我通常将开发数据库保存在我的项目之外。

关于django - 为 Django 教程同步 sqlite3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13503955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com