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

Почему python manage.py migrate выдает ошибку?

Текст ошибки:
Operations to perform: Apply all migrations: admin, auth, contenttypes, news, sessions Running migrations: Applying news.0002_auto_20180911_1540...Traceback (most recent call last): File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return Database.Cursor.execute(self, query, params)sqlite3.IntegrityError: NOT NULL constraint failed: news_articles.author_idThe above exception was the direct cause of the following exception:Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial, File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 115, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 244, in apply_migration state = migration.apply(state, schema_editor) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/migrations/migration.py", line 129, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 88, in database_forwards field, File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/sqlite3/schema.py", line 238, in add_field self._remake_table(model, create_field=field) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/sqlite3/schema.py", line 206, in _remake_table self.quote_name(model._meta.db_table), File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 136, in execute cursor.execute(sql, params) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise raise value.with_traceback(tb) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/home/alexbiryuckoff/djangomysite/myvenv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return Database.Cursor.execute(self, query, params)django.db.utils.IntegrityError: NOT NULL constraint failed: news_articles.author_id
  • Вопрос задан
  • 425 просмотров
Подписаться 1 Простой Комментировать
Решения вопроса 1
@Keofaste
NOT NULL constraint failed: news_articles.author_id

поле news_articles.author_id не может быть null
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

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

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