0

I am following the Neo4django manual: http://neo4django.readthedocs.org/en/latest/auth.html and trying to setup Admin's interface. I am working under Mac OS X.

Before I started setting up this interface, I had my server running and everything worked. After I made the indicated changes, the server stopped with the error: Error: No module named contenttypes. If I disable the contettypes line, I get the error Error: No module named admin.

In my settings.py file:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',      
    'django.contrib.admin',
    'polls',
    'mysite',
    'neo4django.admin',
    'neo4django.contenttypes',
)

In urls.py:

from django.conf.urls import patterns, include, url
from neo4django import admin

admin.autodiscover()

urlpatterns = patterns('',

    (r'^admin/', include(admin.site.urls)),
)

In admin.py:

from neo4django import admin
from .models import Person

class PersonAdmin(admin.ModelAdmin):
    pass

admin.site.register(Person, PersonAdmin)

Could please someone give me correct instructions for setting up the admin's page?

user3241376
  • 407
  • 7
  • 20

1 Answers1

1

I suggest you throw away the entire tutorial for the moment and install neo4django with pip install -e git+https://github.com/scholrly/neo4django/#egg=neo4django. Also check the github https://github.com/scholrly/neo4django and when installing Django, don't install the latest version but the 1.5.4 version with pip install django==1.5.4 Also, install the 1.9.4 version of neo4j and not the 2.0 version.

If for any reason you find neo4django a bit complicated or not mature enough then you can try the py2neo library (not an ORM) or neomodel (https://github.com/robinedwards/neomodel)

nikolasd
  • 318
  • 2
  • 13
  • Thank you very much for the answer! I made pip install -e git+https://github.com/scholrly/neo4django/#egg=neo4django, then I installed django 1.5.4, and then in the same folder with neo4django I installed neo4j 1.8.3 (1.9.4 is not available for download on their website). Now I am trying to start a project: /Users/username/anaconda/lib/python2.7/site-packages/django/bin/django-admin.py startproject myproj ; but I got errors `ImportError: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings`. – user3241376 May 02 '14 at 08:46
  • 1
    Your problem is irrelevent to `neo4django`. You should consult the official `Django` [documentation](https://docs.djangoproject.com/en/1.5/intro/tutorial01/), because from what I understand you have some messed up installation of the tutorial with what I suggested. I recommend to completely delete the tutorial and create a new folder inside which you should run `django-admin.py startproject your_project_name` – nikolasd May 02 '14 at 09:16
  • It worked after I deleted the manual folder! Thank you!)) I will continue trying to set up administrator's page – user3241376 May 02 '14 at 09:41
  • Great! Remember, that the syncdb command does nothing when using neo4django. – nikolasd May 02 '14 at 09:52
  • this I understood already)) Now I cannot actually run the server, getting the error `AttributeError: type object 'Model' has no attribute '__metaclass__'` – user3241376 May 02 '14 at 10:03
  • We have already gone away from original question, so I recommecd you either search this error on StackOverflow, google it or just create correctly your models. Please take a better look on official `neo4django` (https://neo4django.readthedocs.org/en/latest/index.html) and `Django` docs – nikolasd May 02 '14 at 11:41
  • oh I have my models copied from the indicated offical `neo4django`, on which I took a very good look. But neo4django apparently does not support Django 1.5+ , as it is said here: http://stackoverflow.com/questions/16747310/neo4django-attributeerror-type-object-model-has-no-attribute-metaclass – user3241376 May 02 '14 at 11:51
  • I don't remember having such an issue with 1.5 version of `Django` and if you check the issue on github you will see that the issue is closed! Whatever it is, we are only one step from some SO admin, locking the question. – nikolasd May 02 '14 at 12:24