Permalink
Browse files

CF-36 : Fix simple django app.

This changes is to fix simple django app.

Current simple django app is broken.

The cause of this error is incompatible changes in django 1.4.

Django 1.4 release notes / Backwards incompatible changes in 1.4 / django.contrib.admin
http://readthedocs.org/docs/django/en/latest/releases/1.4.html#django-contrib-admin

Details of this change is following.

- Commented out ADMIN_MEDIA_PREFIX.
- Change main funtion.
- Change settings to avoid the following error.

  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.

Change-Id: Ieebf7aac34bd4f5592cebf0a9d5a7468566e3556
  • Loading branch information...
1 parent df75bae commit 13167e10e1142e8cb600109ecf6fa50558395fee @schinen schinen committed May 12, 2012
Showing with 9 additions and 13 deletions.
  1. +4 −11 django/simple_django_app/manage.py
  2. +5 −2 django/simple_django_app/settings.py
@@ -1,14 +1,7 @@
#!/usr/bin/env python
-from django.core.management import execute_manager
-import imp
-try:
- imp.find_module('settings') # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
- sys.exit(1)
-
-import settings
+import os, sys
if __name__ == "__main__":
- execute_manager(settings)
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
+ from django.core.management import execute_from_command_line
+ execute_from_command_line(sys.argv)
@@ -12,7 +12,10 @@
MANAGERS = ADMINS
DATABASES = {
- 'default': {}
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': 'simple_django_app_database'
+ }
}
# Local time zone for this installation. Choices can be found here:
@@ -60,7 +63,7 @@
# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
-ADMIN_MEDIA_PREFIX = '/static/admin/'
+# ADMIN_MEDIA_PREFIX = '/static/admin/'
# Additional locations of static files
STATICFILES_DIRS = (

0 comments on commit 13167e1

Please sign in to comment.