Django error: OperationalError: no such table: polls_poll

Passing through the Django 1 tutorial using Python 2.7 and seems unable to solve this error: OperationalError: no such table: polls_poll

This happens when you enter Poll.objects.all()the shell.

Things I've already tried based on research through the network:

1) Make sure what 'polls'is specified INSTALLED_APPSin settings.py

Note. I saw a lot of sentences inserting 'mysite.polls'instead of 'polls'in INSTALLED_APPS, but this leads to the following error: ImportError: cannot import the name 'polls' from 'mysite'

2) Run it python manage.py syncdb. This creates the db.sqlite3 file successfully and, it would seem, without problems in my mysite folder.

3) Finally, when I start python manage.py shell, the shell runs smoothly, but when I start, I get some strange warning about the runtime and wonder if the error polls_poll : \ django \ db \ backends \ sqlite3 \ base.py: 63: RuntimeWarning: SQLite is related received a naive datetime (2014-02-03 17: 32: 24.392000), while timezone support is active.

Any help would be greatly appreciated.

+3
source share
2 answers

Today I encounter the same problem and fix it. I think you missed some command in tutorial 1, just follow these steps: ./python manage.py makemigrations polls
python manage.py sql polls ./python manage.py syncdb

, , "manage.py makemigrations"

+11

, , models.py migrate..i.e

    python manage.py migrate

(polls_question)

+5

All Articles