Django学習メモ⑥

Djangoマイグレーションのハマりどころ

マイグレーションをしようとしたらうまく行かず、 テーブルが作成されなかった。

以下その時のターミナル


$python manage.py makemigrations No changes detected

$python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: No migrations to apply.

どうやら、makemigrationsを実行するときアプリ名を指定するのがあるべき姿とのこと。


$python manage.py makemigrations anicolle Migrations for 'anicolle': anicolle\migrations\0001_initial.py - Create model Act - Create model Anime - Create model Comment - Create model Directer - Create model Genre - Create model WatchedList - Create model WishList - Add field directer to anime - Add field genre to anime - Add field anime to act

$python manage.py migrate Operations to perform: Apply all migrations: admin, anicolle, auth, contenttypes, sessions Running migrations: Applying anicolle.0001_initial... OK

解決した。

<参考にした記事>

www.monotalk.xyz

www.ganbaruyo.net