neo4j-contrib / django-neomodel

Neomodel plugin for Django
MIT License
290 stars 55 forks source link

issue with install_labels #73

Closed yatharth-pdgt closed 2 years ago

yatharth-pdgt commented 2 years ago
Setting up indexes and constraints...

Found django_neomodel.DjangoNode
 ! Skipping class django_neomodel.DjangoNode is abstract
Found myplace.connections.models.neomodels.UserNode
 + Creating unique constraint for id on label UserNode for class myapp.appname.models.neomodels.UserNode
Traceback (most recent call last):
  File "/Users/pdgt/Desktop/myplace/myplace-be/manage.py", line 19, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/django_neomodel/management/commands/install_labels.py", line 12, in handle
    install_all_labels(stdout=self.stdout)
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/neomodel/core.py", line 155, in install_all_labels
    install_labels(cls, quiet=False, stdout=stdout)
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/neomodel/core.py", line 124, in install_labels
    db.cypher_query("CREATE CONSTRAINT "
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/neomodel/util.py", line 35, in wrapper
    _db.set_connection(config.DATABASE_URL)
  File "/Users/pdgt/.virtualenvs/myplace/lib/python3.9/site-packages/neomodel/util.py", line 92, in set_connection
    p_start = url.replace(':', '', 1).find(':') + 2
AttributeError: 'dict' object has no attribute 'replace'

I set up the NEOMODEL_NEO4J_BOLT_URL = env.db("NEO4J_BOLT_URL", default="bolt://neo4j:neo4j@localhost:7687") in my settings. App is initialized above all the other apps that are using django_neomodels. Why is the config.DATABASE_URL being passed as a dict.

I am trying to run it with PostgreSQL already configured. Is that what's causing the issue? Any workaround? What am I doing wrong?

yatharth-pdgt commented 2 years ago

env.db is wrong. the correct setting should be: NEOMODEL_NEO4J_BOLT_URL = env("NEO4J_BOLT_URL", default="bolt://neo4j:neo4j@localhost:7687")