Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sid is none when I try to migrate #107

Open
hasanabuzayed opened this issue Dec 27, 2015 · 6 comments
Open

sid is none when I try to migrate #107

hasanabuzayed opened this issue Dec 27, 2015 · 6 comments

Comments

@hasanabuzayed
Copy link

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'

@rantecki
Copy link

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?

@epicserve
Copy link
Collaborator

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

@rantecki
Copy link

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

@epicserve
Copy link
Collaborator

@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 epicserve reopened this Mar 14, 2016
@epicserve
Copy link
Collaborator

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants