Answer the question
In order to leave comments, you need to log in
Why doesn't django want to migrate migrations?
I use django 1.9
In general, I created a model:
from django.db import models
# Create your models here.
class content(models.Model):
title = models.CharField(max_length=255)
subTitle = models.CharField(max_length=200)
contactTitle = models.CharField(max_length=255)
address = models.TextField(max_length=500)
subAddress = models.TextField(max_length=300)
def __str__(self):
return self.title
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='content',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('subTitle', models.CharField(max_length=200)),
('contactTitle', models.CharField(max_length=255)),
('address', models.TextField(max_length=500)),
('subAddress', models.TextField(max_length=300)),
],
),
]
(env) MacBook-Pro-Ahmed:landing HeartProgrammer$ python manage.py makemigrations
Migrations for 'content':
0001_initial.py:
- Create model content
(env) MacBook-Pro-Ahmed:landing HeartProgrammer$ python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, content, sessions
Running migrations:
No migrations to apply.
(env) MacBook-Pro-Ahmed:landing HeartProgrammer$
Answer the question
In order to leave comments, you need to log in
The output says that the migration has already been applied before, check the database if you have a content table .
You can also look at the migration entries: SELECT * FROM django_migrations;
It seems that there is even a command for this in django-admin:python manage.py showmigrations
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question