Skip to content

Instantly share code, notes, and snippets.

@klrmn
Created October 4, 2012 21:16
Show Gist options
  • Save klrmn/3836512 to your computer and use it in GitHub Desktop.
Save klrmn/3836512 to your computer and use it in GitHub Desktop.
You need to specify NAME in your Django settings file.
# put local variants on settings.py here to be used by foreman
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'soundfit',
'USER': 'postgres',
'PASSWORD': 'obscured',
'HOST': '',
'PORT': '',
}
}
(env)13:45:00-~/github/soundfit$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/lklrmn/github/soundfit/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/lklrmn/github/soundfit/env/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/lklrmn/github/soundfit/env/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/lklrmn/github/soundfit/env/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/Users/lklrmn/github/soundfit/env/lib/python2.6/site-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File "/Users/lklrmn/github/soundfit/env/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
cursor = connection.cursor()
File "/Users/lklrmn/github/soundfit/env/lib/python2.6/site-packages/django/db/backends/__init__.py", line 306, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/Users/lklrmn/github/soundfit/env/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 162, in _cursor
raise ImproperlyConfigured("You need to specify NAME in your Django settings file.")
django.core.exceptions.ImproperlyConfigured: You need to specify NAME in your Django settings file.
@klrmn
Copy link
Author

klrmn commented Oct 4, 2012

in the settings.py file

import dj_database_url
import os
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
if bool(os.environ.get('LOCAL_DEV', False)):
DATABASES = {'default': dj_database_url.config(default='postgres://postgres:obscured@localhost/soundfit')}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment