django-categories icon indicating copy to clipboard operation
django-categories copied to clipboard

sid is none when I try to migrate

Open hasanabuzayed opened this issue 9 years ago • 6 comments

Every time I try migrate for my project django==1.8.6 django-mptt==0.7.4

and I got this error log

Traceback (most recent call last): File "/Users/hasanabuzayed/Documents/Development/workspace-jee/mix-express/manage.py", line 17, in execute_from_command_line(sys.argv) File "/Library/Python/2.7/site-packages/django/core/management/init.py", line 354, in execute_from_command_line utility.execute() File "/Library/Python/2.7/site-packages/django/core/management/init.py", line 346, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv self.execute(_args, *_cmd_options) File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 445, in execute output = self.handle(_args, *_options) File "/Library/Python/2.7/site-packages/django/core/management/commands/migrate.py", line 226, in handle emit_post_migrate_signal(created_models, self.verbosity, self.interactive, connection.alias) File "/Library/Python/2.7/site-packages/django/core/management/sql.py", line 280, in emit_post_migrate_signal using=db) File "/Library/Python/2.7/site-packages/django/dispatch/dispatcher.py", line 189, in send response = receiver(signal=self, sender=sender, **named) File "/Library/Python/2.7/site-packages/categories/migration.py", line 61, in migrate_app transaction.savepoint_commit(sid) File "/Library/Python/2.7/site-packages/django/db/transaction.py", line 74, in savepoint_commit get_connection(using).savepoint_commit(sid) File "/Library/Python/2.7/site-packages/django/db/backends/base/base.py", line 264, in savepoint_commit self._savepoint_commit(sid) File "/Library/Python/2.7/site-packages/django/db/backends/base/base.py", line 218, in _savepoint_commit cursor.execute(self.ops.savepoint_commit_sql(sid)) File "/Library/Python/2.7/site-packages/django/db/backends/base/operations.py", line 348, in savepoint_commit_sql return "RELEASE SAVEPOINT %s" % self.quote_name(sid) File "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/operations.py", line 98, in quote_name if name.startswith('"') and name.endswith('"'): AttributeError: 'NoneType' object has no attribute 'startswith'

hasanabuzayed avatar Dec 27 '15 08:12 hasanabuzayed

I got this too when attempting initial migration of the example project on Django 1.8.11.

On Django 1.9.4 it dies even earlier with:

django.db.utils.OperationalError: no such table: django_content_type

This leads me to wonder under what circumstances does the example project actually work?

rantecki avatar Mar 11 '16 01:03 rantecki

What version of django-categories are you using? Is "categories" in your INSTALLED_APPS?

epicserve avatar Mar 12 '16 19:03 epicserve

I was using the current HEAD at the time, which was 7f27053.

The settings file was the one from the example project, and it looks like "categories" is indeed in INSTALLED_APPS in the example settings.

Basically what I did was:

  • git clone
  • create virtual env
  • pip install -r requirements.txt
  • cd example
  • ./manage.py migrate

rantecki avatar Mar 14 '16 05:03 rantecki

@rantecki, very interesting. I'll have to try that out. We probably need to add a test to catch this, because right now all tests are passing.

epicserve avatar Mar 14 '16 13:03 epicserve

I added pull request #114, this is my "scratch pad" for trying to fix this issue. It basically makes migrate work in the example app, however like the PR says, "the admin will have some bugs because of my change in categories/genericcollection.py and none of the tables needed for the Django flatpages app and the Example simpletext app will have been created.

If you undo the changes in categories/genericcollection.py, you'll get a sqlite3.OperationalError: no such table: django_content_type error.

If you undo the changes in categories/migration.py, you'll get the AttributeError: 'NoneType' object has no attribute 'startswith' error again.

I've run out of time tonight to work on this, so if anyone else has some solutions, please feel free to offer them up. :) I'm not sure when I'll have time to work on this again for awhile. :)

epicserve avatar Mar 15 '16 01:03 epicserve

Did some more work this morning. Got it working in PR #114. However the fix in categories/genericcollection.py feels like a hack. It would be nice to find a better solution. It also should be noted that while the admin loads there still seems to be some bugs. I've never used the example site before so I'm not sure how it was suppose to work. Also the admin has changes a lot in Django 1.9 so I don't know which bugs may or may not have been caused by Django 1.9.

epicserve avatar Mar 15 '16 14:03 epicserve