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.

[Django] マイグレーション時にNo changes detectedと言われる

Posted at

前提

  • Djangoの環境を構築済であること

環境

  • macOS
  • Docker
    • Django
    • MySQL

経緯

  1. アプリケーションを新規作成
  2. model.pyを編集してモデルを作成
  3. docker内のアプリケーションコンテナにdocker exec -it app bashで入る
  4. python manage.py makemigrationsを実行したら 「No changes detected」 と言われた。

python manage.py makemigrations <アプリ名>としても同様

結論

setting.pyINSTALLED_APPSに新規作成したアプリを追加していなかったことが原因。

setting.py
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "analysis.apps.AnalysisConfig",  # ここに追加
]

↓↓これで解決。

実行結果
Migrations for 'analysis':
  analysis/migrations/0001_initial.py
    - Create model Area
    - Create model Division
    - Create model Shop
    - Create model ShopSales
    - Create model Product

以上

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?