将 django 设置中的 BASE_DIR 更改为目录
我正在研究Django项目,我尝试在其中设置多个设置文件,现在我正在获取数据库迁移错误/通知。我不想创建新的DB并使用上一个DB。
以前的dir结构
|myproject
|-myproject
|--settings.py
|-db
和我的base.py base_dir = path(__ file __)。resolve()。parent.parrent.parent
当前的dir
|myproject
|-myproject
|--db(new db after running sever)
|--settings
|---base.py
|---development.py
|-db(old db)
我没有base_dir事情的工作原理。我想使用我的旧数据库和所有其他东西。我尝试了Google,但我在那里不了解任何东西。因此,我如何提高一个dir我的base_dir路径。
事先感谢任何建议将有所帮助。
I am working on django project in which I tried to setup multiple settings files and now I am getting database migrations error/notification .I dont want to create new db and use the previous one .
Previous dir Structure
|myproject
|-myproject
|--settings.py
|-db
and in my base.py BASE_DIR = Path(__file__).resolve().parent.parent
Current Dir
|myproject
|-myproject
|--db(new db after running sever)
|--settings
|---base.py
|---development.py
|-db(old db)
I dont how base_dir thing works .I want to use my old db and all other stuff .I tried google but I dont understand anything there.so how to I up one dir my BASE_DIR path .
Thanks in advance any advice will be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请尝试以下操作:
BASE_DIR = 路径(文件).resolve().parent.parent.parent
Try the following:
BASE_DIR = Path(file).resolve().parent.parent.parent