【发布时间】:2022-07-30 22:44:52
【问题描述】:
所以我是 Django 新手,熟悉 Python 并学习 Pycharm IDE。试图为我的 3 个男孩和妻子设置一个博客页面来记录我们的疯狂,并在我向程序中添加应用程序时遇到了这个问题。当我使用 Django startapp 命令尝试启动一个 todolist 应用程序时,我得到了这个结果,并且没有创建新的应用程序......我肯定对问题所在感到困惑。感谢您提供任何反馈。
(.three_gees_venv) PS C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend> python manage.py startapp todolist
Traceback (most recent call last):
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-backend\manage.py",
line 22, in <module>
main()
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-backend\manage.py", line
18, in main
execute_from_command_line(sys.argv)
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
\.three_gees_venv\lib\site-packages\django\core\management\__init__.py", line 446, in
execute_from_command_line
utility.execute()
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend\.three_gees_venv\lib\site-packages\django\core\management\__init__.py", line
420,
in execute
django.setup()
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend\.three_gees_venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend\.three_gees_venv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend\.three_gees_venv\lib\site-packages\django\apps\config.py", line 228, in create
import_module(entry)
File
"C:\Users\geeks\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line
126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1047, in _gcd_import
File "<frozen importlib._bootstrap>", line 981, in _sanity_check
ValueError: Empty module name
【问题讨论】:
-
hmm 请尝试以下操作:创建一个名为“applications/todolist”的新目录(例如)并运行
python manage.py startapp todolist applications/todolist