table already exists error, but only when running the migrate command using python3.python3 manage.py migrate. For instance, python3 manage.py test works just fine, which is a bit baffling given test first runs the migrations. Running python2 manage.py migrate works just fine, no errors.File "/usr/local/lib/python3.6/site-packages/django/db/migrations/recorder.py" , line 59, in ensure_schema raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc) django.db.migrations.exceptions .MigrationSchemaMissing: Unable to create the django_migrations table (table "django_migrations" already exists)I run into this exact same issue—broken with Python 3 but working with Python 2—on multiple computers, so I'd imagine anyone else will see the same issue. You should be able to reproduce the issue with the following steps:
git clone git@github.com:alexdlaird/django-bootstrap- authentication-template- project.git && cd django-bootstrap- authentication-template- project make installpython2 manage.py migrate- note that it works just finerm db.sqlitefor a fresh startpython3 manage.py migrate- note that it fails with the error shown above 5x.rm db.sqlitefor a fresh start 5x.python3 manage.py test- note that it works just fine
To see the migrations run against a MySQL instance (the project assumes you have a default Homebrew MySQL instance running locally, but this can be configured in .env if not), run python3 manage.py migrate and observe that this works just fine with Python 2 or 3, so the issue appears isolated to SQLite migrations.
I have done a bit of debugging with this issue myself, swapping back and forth between Python 2.7 and Python 3.6. What I'm seeing is that I believe the issue is related to Unicode strings and table names in Python 3, but I'm not sure where the best place to address this would be. For example, watching the returned get_tables_list in value of in python3.6/django/db/backends/
Am I doing something wrong? Is this a valid bug? I have also written about it on Stackoverflow here: https://stackoverflow.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cc149c2b-2fb4-46e5-82de-47932a858327%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment