3

I am working on a django project and I have two databases "mysql " and " neo4j" .I install neo4django package and change the setting.py like below:

setting.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', 
        'NAME': 'mylifetime',                     
        'USER': 'root',
        'PASSWORD': 'mypassword',
        'HOST': '',                      
        'PORT': '',
    }
}
NEO4J_DATABASES = {
    'default' : {
        'HOST':'localhost',
        'PORT':7474,
        'ENDPOINT':'/db/data'
    }
}

and my models currently have only neo4j models:

models.py:

from neo4django.db import models


class User(models.NodeModel):
    ...
    #my User models ...
    ....
class Post(models.NodeModel):
    ...
    #my Post models
    ...

when i run this command python manage.py syncdb I got error :

$ python ../manage.py syncdb
Creating tables ...
AttributeError: 'super' object has no attribute 'db_type'

When I use only MySql models I don't see the errors and tables will create successfully. where Am I wrong ? thanks

EDIT: when I write python manage.py syncdb --traceback I see below :

Creating tables ...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 222, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 255, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 385, in handle
    return self.handle_noargs(**options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 91, in handle_noargs
    sql, references = connection.creation.sql_create_model(model, self.style, seen_models)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/creation.py", line 50, in sql_create_model
    col_type = f.db_type(connection=self.connection)
  File "/usr/local/lib/python2.7/dist-packages/neo4django-0.1.8-py2.7.egg/neo4django/utils.py", line 303, in __getattr__
    return getattr(target, name)
AttributeError: 'super' object has no attribute 'db_type'
2
  • see this: github.com/scholrly/neo4django/issues/105 Commented Aug 10, 2013 at 11:45
  • 1
    thanks.i don't insert DATABASE_ROUTERS = ['neo4django.utils.Neo4djangoIntegrationRouter'] following in the neo4j_docs in the settings.py.but really what is it ? Commented Aug 10, 2013 at 11:55

2 Answers 2

3

Use the --traceback option to manage.py to see a full stack trace of the exception you get.

Sign up to request clarification or add additional context in comments.

1 Comment

I didn't know this option exists! +1
2

As noted in the docs, if you want to run against Neo4j and a relational DB, you need to add neo4django.utils.Neo4djangoIntegrationRouter to your DATABASE_ROUTERS in settings.py.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.