Задать вопрос
@Steve_Smith

Python manage.py migrate. В чем ошибка?

(studentsdb)leits@leits-PC:~/data/work/virtualenvs/studentsdb/src/studentsdb$ python manage.py makemigrations students
Migrations for 'students':
  0001_initial.py:
    - Create model Student
(studentsdb)leits@leits-PC:~/data/work/virtualenvs/studentsdb/src/studentsdb$ python manage.py migrate
Operations to perform:
  Apply all migrations: admin, students, contenttypes, auth, sessions
Running migrations:
  No migrations to apply.
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 164, in handle
    emit_post_migrate_signal(created_models, self.verbosity, self.interactive, connection.alias)
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/core/management/sql.py", line 268, in emit_post_migrate_signal
    using=db)
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 198, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 83, in create_permissions
    ctype = ContentType.objects.db_manager(using).get_for_model(klass)
  File "/home/leits/data/work/virtualenvs/studentsdb/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 58, in get_for_model
    " is migrated before trying to migrate apps individually."
RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.
  • Вопрос задан
  • 8034 просмотра
Подписаться 2 Оценить 1 комментарий
Решения вопроса 1
@Steve_Smith Автор вопроса
Решил. Удалил и создал заново db.sqlite3.
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 3
@deliro
Вы не создали миграции для других приложений. Уберите из
python manage.py makemigrations students students.
Ответ написан
zelsky
@zelsky
Так себе книга у него. +Обратис к ним в "тусовку приобрешвих книгу" там помогут.
Ответ написан
Комментировать
sim3x
@sim3x
Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.

попробуй так
python manage.py migrate contenttypes
python manage.py makemigrations
python manage.py migrate
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы