Django Tutorial | sqlmigrate command ending in error

54 views
Skip to first unread message

Nikhil Reddy

unread,
Apr 21, 2017, 9:10:43 AM4/21/17
to Django users
Hi,

I am going through this tutorial. When I execute the command: "python manage.py sqlmigrate polls 0001" it is ending in below error.
Please help resolve the issue.

Error:
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/commands/sqlmigrate.py", line 33, in execute
    return super(Command, self).execute(*args, **options)
  File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/core/management/commands/sqlmigrate.py", line 62, in handle
    sql_statements = executor.collect_sql(plan)
  File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/db/migrations/executor.py", line 219, in collect_sql
    with self.connection.schema_editor(collect_sql=True, atomic=migration.atomic) as schema_editor:
  File "/scratch/njakkula/NJ/py_Oracle/bugdb/triage/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py", line 25, in __enter__
    self._initial_pragma_fk = c.fetchone()[0]
TypeError: 'NoneType' object has no attribute '__getitem__'

Versions:
Python 2.7.13
Django 1.11
sqlite3 2.6.0

Nikhil Reddy

unread,
Apr 30, 2017, 8:43:24 AM4/30/17
to Django users
Can anyone kindly help me on this issue?

Thanks,
Nikhil

Daniel Roseman

unread,
Apr 30, 2017, 10:00:28 AM4/30/17
to Django users
You haven't given nearly enough information to help you. You need at least to post the contents of your polls/migrations/0001_initial.py, and your DATABASES settings.
--
DR.

Dilraj sachdev

unread,
May 1, 2017, 7:20:11 AM5/1/17
to Django users

By this limited information, just guessing could be a problem with path of sqlite db file

D

Nikhil Reddy

unread,
May 1, 2017, 10:10:45 AM5/1/17
to Django users
Ok..Sorry about that. 

I haven't done any modifications to  polls/migrations/0001_initial.py or settings files that got created by default.  I've attached both files.
Please review.

Thanks,
NJ
0001_initial.py
settings.py
Reply all
Reply to author
Forward
0 new messages