Re: Django and Neo4J - installation issue

331 views
Skip to first unread message

Matt Luongo

unread,
Jun 7, 2013, 6:34:34 PM6/7/13
to ne...@googlegroups.com
Have you tried importing `Person` from your models module? Eg `from my_project.my_app.models import Person`.

The docs were written expecting people to be familiar with the Python path and Django project layout, and glosses over non-neo4django-specific imports- I'm planning a more comprehensive tutorial / example app soon that I hope will address those needs. Until then, I'd appreciate any suggestions to make the language / examples in the docs more clear.

On Friday, June 7, 2013 2:26:23 PM UTC-4, Nimrod M wrote:
 
Hello, 
I installed neo4django and followed the tutorial 


but after I created the models I cannot create the models objects.

What could be the reason?


models.py
# from django.db import models
from neo4django.db import models

class Person(models.NodeModel):
    name = models.StringProperty()
    age = models.IntegerProperty()

    friends = models.Relationship('self',rel_type='friends_with')

class OnlinePerson(Person):
email = models.EmailProperty()
homepage = models.URLProperty()

class EmployedPerson(Person):
    job_title = models.StringProperty(indexed=True)


settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        # 'NAME': os.path.join(BASE_DIR, 'db', 'test_database.sqlite3')
    }
}

NEO4J_DATABASES = {
    'default' : {
        'HOST':'localhost',
        'PORT':7474,
        'ENDPOINT':'/db/data'
    }
}

DATABASE_ROUTERS = ['neo4django.utils.Neo4djangoIntegrationRouter']


-------------------
Shell

Nimrod:neo elianamordekovich$ python neo/manage.py shell
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> pete = Person.objects.create(name='Pete', age=30)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'Person' is not defined
>>> 



Thanks in advance!
Nimrod

Nimrod M

unread,
Jun 9, 2013, 4:17:20 AM6/9/13
to ne...@googlegroups.com
Yes, I did it.
Anyway, now I have an another problem.
I didn't find any similar issue on my searches.
Do you know how to help?

>>> from person.models import *
>>> pete = Person.objects.create(name='Pete', age=30)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4django/db/models/manager.py", line 42, in create
    return self.get_query_set().create(**kwargs)
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4django/db/models/query.py", line 1052, in create
    return super(NodeQuerySet, self).create(**kwargs)
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/django/db/models/query.py", line 377, in create
    obj.save(force_insert=True, using=self.db)
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4django/db/models/base.py", line 325, in save
    return super(NodeModel, self).save(using=using, **kwargs)
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/django/db/models/base.py", line 463, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4django/db/models/base.py", line 341, in save_base
    self._save_neo4j_node(using)
  File "<string>", line 2, in _save_neo4j_node
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4django/db/models/base.py", line 115, in trans_method
    ret = func(*args, **kw)
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4django/db/models/base.py", line 371, in _save_neo4j_node
    typesToIndex=type_names_to_index)
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4django/neo4jclient.py", line 178, in gremlin_tx
    return self.gremlin(script, tx=True, **params)
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4django/neo4jclient.py", line 126, in gremlin
    ext = self.extensions.GremlinPlugin
  File "/Users/ee/Development/projects/mycoolproject/lib/python2.7/site-packages/neo4jrestclient/client.py", line 2086, in __getattr__
    self._dict[attr] = ExtensionModule(self._extensions[attr], self._auth)
KeyError: 'GremlinPlugin'


Thanks!



בתאריך יום שבת, 8 ביוני 2013 01:34:34 UTC+3, מאת Matt Luongo:

Matt Luongo

unread,
Jun 9, 2013, 10:41:34 AM6/9/13
to ne...@googlegroups.com

What version of Neo4j are you using? Neo4django master supports 1.8.2 and 1.9, while the release on PyPi only supports up to 1.8.2. It looks like you're missing the GremlinPlugin, which was removed by default after Neo4j 1.9, and is currently a neo4django requirement.

--
You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/CdNQshq0nFI/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Nimrod M

unread,
Jun 9, 2013, 4:44:36 PM6/9/13
to ne...@googlegroups.com
Thank you for your comment.
I'm using in community-1.9-unix version.
I installed it by the commands:
brew update
brew install neo4j
neo4j start

Do you have any idea?

I really will appreciate your help.


בתאריך יום ראשון, 9 ביוני 2013 17:41:34 UTC+3, מאת Matt Luongo:

Nimrod M

unread,
Jun 9, 2013, 4:58:35 PM6/9/13
to ne...@googlegroups.com
I managed to solve it.
Just killed a locked process and then restarted the neo4j server.

Thank you.

בתאריך יום ראשון, 9 ביוני 2013 23:44:36 UTC+3, מאת Nimrod M:

Matt Luongo

unread,
Jun 9, 2013, 5:01:13 PM6/9/13
to ne...@googlegroups.com

Could you run `curl -XGET 'http://localhost:7474/db/data/' while the database is running and share the result?

Nimrod M

unread,
Jun 9, 2013, 5:10:43 PM6/9/13
to ne...@googlegroups.com
I got it:

(mycoolproject)Nimrod:neo_test ee$ curl -XGET 'http://localhost:7474/db/data/'
{
  "extensions" : {
    "CypherPlugin" : {
    },
    "GremlinPlugin" : {
    }
  },
  "reference_node" : "http://localhost:7474/db/data/node/0",
  "extensions_info" : "http://localhost:7474/db/data/ext",
  "neo4j_version" : "1.9"

Is it fine?

I have an another issue now...
I cannot open the url http://localhost:7474.
I think it's because of the virtualenv.
What should I do in order to view the neo4j pages?



בתאריך יום שני, 10 ביוני 2013 00:01:13 UTC+3, מאת Matt Luongo:

Matt Luongo

unread,
Jun 9, 2013, 5:24:12 PM6/9/13
to ne...@googlegroups.com

The virtualenv is just for Python packages- it shouldn't affect browsing the Neo4j interface. If you can curl the port, you *should* be able to visit it with a browser.

Anyone have any ideas?

Nimrod M

unread,
Jun 9, 2013, 6:09:41 PM6/9/13
to ne...@googlegroups.com
Once I'm running neo4j start
I get the message:

WARNING! You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7.
Starting Neo4j Server...WARNING: not changing user
process [83944]... waiting for server to be ready...... OK.
Go to http://localhost:7474/webadmin/ for administration interface.


and it's although I updated it to JDK7..
Perhaps I need change something in my paths?
I use OSX.
The link still is not working

Any advices?




בתאריך יום שני, 10 ביוני 2013 00:24:12 UTC+3, מאת Matt Luongo:

Dela Lange

unread,
Jan 2, 2014, 7:56:58 AM1/2/14
to ne...@googlegroups.com
I got the same problem on my Raspberry Pi.

First check your java version with
java -version

is it 1.7 ? 
If not, then update.
If yes, is it openjdk7 or oracle jdk?
On my raspberry it din't run with oracle, but with opendjk, so maybe u try this.

Michael Hunger

unread,
Jan 2, 2014, 9:16:51 PM1/2/14
to ne...@googlegroups.com
What does 
java -version

and

/usr/libexec/java_home -v 1.7

report ?

Michael

You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages