After some errors, I dropped my database, deleted all my migration files (I left init.py). Now, when I run
python migrate.py makemigrations /
python manage.py migrate --fake APPNAME zero
This will make your migration to fake. Now you can run the migrate script
python manage.py migrate APPNAME
Tables will be created and you solved your problem.. Cheers!!!
Please check if you are using multiple databases in your project. If multiple databases configured, check the default database is the one you are looking for.
If default and your expected database are different, run below command pointing to your db configuration.
python manage.py migrate $app_name --database $dbname_from_setting
Hope this helps.
I face same issue:
python manage.py migrate poll
Operations to perform:
Apply all migrations: poll
Running migrations:
No migrations to apply.
Follow these steps to create tables for your app.
Go to your app folder
1.delete migration folder.
2.python manage.py makemigrations.
3 Rename 0001_initial.py file to 0001_initial_manual.py.
4 python manage.py migrate APPNAME.
After this my tables created smoothly.
python manage.py migrate poll
Operations to perform:
Apply all migrations: poll
Running migrations:
Applying poll.0002_initial... OK
The answer to this depends if you already have a history of migrations in your app folder. In my case I didn't...I think I deleted original migration scripts.
python manage.py makemigrations yourapp
python manage.py migrate --fake-initial
Follow steps in section Workflow ...
python manage.py makemigrations yourapp
python manage.py migrate
This is how I got @JulienD's answer to work:
class thing(models.Model):
name = models.CharField(max_length=200)
class Meta:
app_label = 'things'
managed = True
python manage.py makemigrations
python manage.py migrate
After that python manage.py showmigrations
shows the migrations and the admin site started working.
I had manually deleted one of the tables and the trick that worked for me was to execute the following steps:
Note: earlier I was not executing the #3 step and the table was not getting created. my django version: v3.0.5