arachnys / cabot

Self-hosted, easily-deployable monitoring and alerts service - like a lightweight PagerDuty
MIT License
5.59k stars 593 forks source link

settings.DATABASES is improperly configured #627

Open payton opened 6 years ago

payton commented 6 years ago

I'm new to Django, so I don't quite know how to go about this error that occurs when I try to make migrations:

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/pgarland/dev/github/cabot/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/Users/pgarland/dev/github/cabot/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/pgarland/dev/github/cabot/venv/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/pgarland/dev/github/cabot/venv/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/Users/pgarland/dev/github/cabot/venv/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py", line 32, in handle
    for line in self.handle_inspection(options):
  File "/Users/pgarland/dev/github/cabot/venv/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py", line 48, in handle_inspection
    with connection.cursor() as cursor:
  File "/Users/pgarland/dev/github/cabot/venv/lib/python2.7/site-packages/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/Users/pgarland/dev/github/cabot/venv/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 20, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

I manually added the engine value, but this step also wasn't mentioned anywhere in the development instructions, so perhaps it is something else I did wrong? Any help would be greatly appreciated.

Thanks!

UPDATE: In dj_database_url.py, the line s = os.environ.get(env, default) just returns None, so the function returns an empty dictionary as the config.

onagorodniuk commented 4 years ago

Hello, your production.env config should have variable: DATABASE_URL=postgres://postgres@postgres:5432/postgres

davinbirdi commented 4 years ago

I'm having issue as @payton even with the DATABASE_URL set in the local .env file, do you know what else could be the issue?

Edit: This may help: https://stackoverflow.com/questions/16868451/how-to-set-up-database-for-django-app-on-heroku

Bukharee commented 3 years ago

having the same issue but everyone seems to be quite, help!

i-am-b-soto commented 3 years ago

hi. I seem to be getting the same issue when deploying to Heroku. Could this be a problem with Heroku not setting the DATABASE_URL for some reason?