进行迁移时出现无效的语法错误

时间:2018-09-11 09:06:23

标签: database neo4j

我已经在Django中安装了neo4j数据库

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

NEO4J_DATABASES = {
'default' : {
    'HOST':'localhost',
    'PORT':8000,
    'ENDPOINT':'/db/data'
}
}
DATABASE_ROUTERS = ['neo4django.utils.Neo4djangoIntegrationRouter']

模型部分:

#from django.db import models
from neo4django.db import models
from django.urls import reverse

class Customerr(models.NodeModel):
name=models.StringProperty()
email=models.StringProperty()
phno=models.StringProperty()
gender=models.StringProperty()
dp=models.StringProperty()

在执行命令时:     python manage.py makemigrations食物

PS C:\Users\Gaurav Pathak\Desktop\Swiggy> python manage.py makemigrations Food
Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
  File "C:\Users\Gaurav Pathak\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\__init__.py", line 54
    except ImportError,e:
                      ^
SyntaxError: invalid syntax

1 个答案:

答案 0 :(得分:0)

neo4django的最后一次提交是在4年前,其自述文件指出:

  

该库针对Django 1.5.4和Neo4j版本进行了测试   1.8.2-1.9.4。

这些是Django和neo4j的非常旧的版本,很可能是造成您问题的原因。

对于using Python with neo4j,您应该改用其他方法。