Search code examples
pythondjangopostgresqlgraphite

Why I cannot create a database for graphite-web?


I am trying to install graphite-web on my computer by following the instructions on https://gist.github.com/surjikal/2777886. When I try to populate the database with manage.py syncdb it does not find a proper database throwing the following error:

> sudo python manage.py syncdb
OperationalError: FATAL:  database "/opt/graphite/storage/graphite.db" does not exist

Here you can find my database configuration from local_settings.py:

DATABASES = {
    'default': {
        'NAME': '/opt/graphite/storage/graphite.db',
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'USER': 'graphite',
        'PASSWORD': '<password>',
        'HOST': 'localhost',
        'PORT': '5678'
    }
}

Postgres is running properly:

sudo service --status-all | grep postgres 
...
[ + ]  postgresql

Why manage.py syncdb cannot create / find the graphite.db file?


Solution

  • If you are using postgresql then database path will not be required. You just need database name. like

    DATABASES = {
    'default': {
        'NAME': 'graphite',
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'USER': 'graphite',
        'PASSWORD': '<password>',
        'HOST': 'localhost',
        'PORT': '5678'
        }
    }