Django migrate : doesn't create tables

前端 未结 10 1724
独厮守ぢ
独厮守ぢ 2021-01-31 18:03

After some errors, I dropped my database, deleted all my migration files (I left init.py). Now, when I run

python migrate.py makemigrations   /         


        
10条回答
  •  攒了一身酷
    2021-01-31 18:50

    This is how I got @JulienD's answer to work:

    1. I added metadata to my model def in models.py:

    class thing(models.Model): name = models.CharField(max_length=200) class Meta: app_label = 'things' managed = True

    1. Execute:

    python manage.py makemigrations

    1. Execute:

    python manage.py migrate

    After that python manage.py showmigrations shows the migrations and the admin site started working.

提交回复
热议问题