项目启动失败

我项目的文档结构是这样的。 . ├── db.sqlite3 ├── manage.py ├── spoken_django │   ├── init.py │   ├── pycache │   │   ├── init.cpython-311.pyc │   │   ├── init.cpython-39.pyc │   │   ├── settings.cpython-311.pyc │   │   ├── settings.cpython-39.pyc │   │   ├── urls.cpython-311.pyc │   │   ├── urls.cpython-39.pyc │   │   ├── wsgi.cpython-311.pyc │   │   └── wsgi.cpython-39.pyc │   ├── apps │   │   └── spoken_app │   │   ├── init.py │   │   ├── pycache │   │   │   ├── init.cpython-39.pyc │   │   │   ├── admin.cpython-39.pyc │   │   │   ├── apps.cpython-39.pyc │   │   │   ├── backend_service.cpython-39.pyc │   │   │   ├── models.cpython-39.pyc │   │   │   └── views.cpython-39.pyc │   │   ├── admin.py │   │   ├── apps.py │   │   ├── backend_service.py │   │   ├── migrations │   │   │   ├── 0001_initial.py │   │   │   ├── 0002_remove_wordsound_context.py │   │   │   ├── 0003_alter_sentence_word_id.py │   │   │   ├── init.py │   │   │   └── pycache │   │   │   ├── 0001_initial.cpython-39.pyc │   │   │   ├── 0002_remove_wordsound_context.cpython-39.pyc │   │   │   ├── 0002_sentence_words_wordsound_wordsentence_sentencesound.cpython-39.pyc │   │   │   ├── 0003_alter_sentence_word_id.cpython-39.pyc │   │   │   └── init.cpython-39.pyc │   │   ├── models.py │   │   ├── tests.py │   │   └── views.py │   ├── asgi.py │   ├── settings.py │   ├── urls.py │   └── wsgi.py └── test.py

settings里面的相关设置是这样的

BASE_DIR = Path(file).resolve().parent

INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "corsheaders", "spoken_app", ]

Apps.py里面是这样的 from django.apps import AppConfig

class SpokenAppConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "spoken_app"

default_app_config="spoken_app.apps.SpokenAppConfig"

现在遇到的问题是,我的manage.py没法运行

我在命令行输入python manage.py 后面无论接什么参数都会报错

File "/Users/mark/opt/anaconda3/envs/spoken_backend_env/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'spoken_app'

我能理解这个报错与项目或应用的路径有关系,但是我找不到解决的方法。

请帮我看看我应该怎么调整目录解决这个问题。

评论 1