1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【備忘録】【エラー解決】ModuleNotFoundError: No module named 'todos,'

Posted at

DjangoとReactの開発環境を完全に独立させたTodoアプリを作っています。
migrationファイルを作成しようとして下記を実行した結果、

仮想環境上のターミナル
python manage.py makemigrations todos

このように、エラーが返ってきました。

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/Users/asamitakaoka/Desktop/todo-react/lib/python3.8/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
    utility.execute()
  File "/Users/asamitakaoka/Desktop/todo-react/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute
    django.setup()
  File "/Users/asamitakaoka/Desktop/todo-react/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/asamitakaoka/Desktop/todo-react/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/Users/asamitakaoka/Desktop/todo-react/lib/python3.8/site-packages/django/apps/config.py", line 223, in create
    import_module(entry)
  File "/Users/asamitakaoka/.pyenv/versions/3.8.2/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'todos,'

原因として考えられること

・プロジェクトにアプリを作ってない (プロジェクトディレクトリに todo というディレクトリがあるはず)
・settings.py の INSTALLED_APPS に todo を追加していない
・todo 内のアプリ構成に何か問題がある

解決策

settings.py の INSTALLED_APPS をよく見てみたところ、
'todos,' と記述していました。
正しくは、

'todos', 

でした。カンマの位置が違っていました。

参考記事

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?