Graphite need to be made compatible with Django 1.4

Reported by Michael Leinartas on 2012-03-24
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Graphite
Fix Released
High
Unassigned

Bug Description

Django 1.4 has been released (<https://docs.djangoproject.com/en/dev/releases/1.4/>) and there are at least a few changes that need to be made due to deprecations.

So far, these are what I see. Most of these changes were introduced in 1.2 and are now forced in 1.4:
* function based template loaders are gone in favor of class-based ones
* database configuration is a new dictionary format and requires fully qualified module names (just 'sqlite3' wont work)
* changes to admin content

Not sure how far back we want to go with Django support. As painful as it is, there are a lot of users still on CentOS 5 - EPEL has Django 1.1. Supporting 1.2-1.4 seems easiest, but making the database config change could cause some pain as users would have to change their configuration after update.

rcrowley (r-rcrowley) wrote :

The fix is to replace TEMPLATE_LOADERS in settings.py with:

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

rcrowley (r-rcrowley) wrote :

And the DATABASES part is:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(STORAGE_DIR, 'graphite.db'),
    },
}

Michael Leinartas (mleinartas) wrote :

I've committed a fix, though the database part is somewhat crappy. I wanted to avoid breaking those on Django 1.2 and 1.3 with the old style database config so did not set a default DATABASES dictionary. It's possible to do so but somewhat messy as Django 1.2+ will ignore the old style configs if DATABASES doesn't coerce to False. Once we drop support for 1.1 we can remove the old style completely and announce a required change to local_settings.py as well as remove the case statement added for the TEMPLATE_LOADERS

Michael Leinartas (mleinartas) wrote :

Committed in r744

Changed in graphite:
status: Confirmed → Fix Committed
Deshi Xiao (xiaods) wrote :

it seems should be change DATABASE style in settting.py
if i apply this blow code in settting.py
DATABASES = {
    'default': {
        'NAME': os.path.join(STORAGE_DIR, 'graphite.db'),
        'ENGINE': 'django.db.backends.sqlite3',
    }
}
,the error always show
...
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.

when i add above configure, it's works.so i suggest upgrate to django 1.4 right now on 0.9.10

Changed in graphite:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers