Graphite does not work with Django 1.5, Python 2.6.6

Bug #1158463 reported by Steve Keller
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Graphite
New
Undecided
Unassigned

Bug Description

Just installed Graphite on a new system, used pip to install Django. The current Django version is 1.5.

When I try to set up the web app, running manage.py fails:

python manage.py syncdb
/usr/lib/python2.6/site-packages/django/core/management/__init__.py:465: DeprecationWarning: The 'execute_manager' function is deprecated, you likely need to update your 'manage.py'; please see the Django 1.4 release notes (https://docs.djangoproject.com/en/dev/releases/1.4/).
  DeprecationWarning)
/usr/lib/python2.6/site-packages/django/core/management/__init__.py:409: DeprecationWarning: The 'setup_environ' function is deprecated, you likely need to update your 'manage.py'; please see the Django 1.4 release notes (https://docs.djangoproject.com/en/dev/releases/1.4/).
  DeprecationWarning)
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 469, in execute_manager
    utility.execute()
  File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 77, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 8, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
  File "/usr/lib/python2.6/site-packages/django/core/management/sql.py", line 9, in <module>
    from django.db import models
  File "/usr/lib/python2.6/site-packages/django/db/__init__.py", line 11, in <module>
    if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:
  File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 52, in __getattr__
    self._setup(name)
  File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 47, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 150, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

This is on a RHEL 6 64 bit system, Python 2.6.6.

Revision history for this message
John Vilaikeo (jvilaikeo) wrote :

Add a value to Secret_Key='' in the local_settings.py and the exception will go away...

Revision history for this message
Brian Candler (b-candler) wrote :

Then you get another error about suspicious activity, something to do with ALLOWED_HOSTS not being set.

So you add ALLOWED_HOSTS = ['graphite.mydomain.com'] to settings.py

Then you get another error:

"ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details."

(i.e. https://docs.djangoproject.com/en/dev/ref/settings/ )

So you also add to the end of settings.py:

DATABASES = {
'default': {
        'ENGINE': DATABASE_ENGINE,
        'NAME': DATABASE_NAME,
        'USER': DATABASE_USER,
        'PASSWORD': DATABASE_PASSWORD,
        'HOST': DATABASE_HOST,
        'PORT': DATABASE_PORT,
},
}

Basically, graphite has not been updated to match django 1.5. This is the fault of graphite, not ubuntu (and in any case you're using a pip version of django, not an ubuntu version)

Other notes: you'll also need
apt-get install python-dev libapache2-mod-wsgi python-pysqlite2
pip install django-tagging

Revision history for this message
Brian Candler (b-candler) wrote :

Also:
apt-get install python-cairo

Revision history for this message
Steve Keller (skeller-ea) wrote :

Thanks folks. I actually tried to put a value in the SECRET_KEY, and the exception did not go away.

Brian's comment that Graphite has not been updated to match Django 1.5 is correct. Regarding the other packages that Brian mentions, they are already installed (though we are using MySQL, not SQL-Lite).

Since this is the umpteenth install for Graphite that I've done, I'm pretty familiar with the process. I was actually setting up to create a Puppet profile for a Graphite server, so that we can install Graphite where ever we need in the environment. We currently have 6 production Graphite systems, 3 of them are clustered and report monitoring data from our world wide environment.

The real issue here is two-fold:
1) Graphite's setup script, manage.py and the default settings files need to be updated to accommodate Django 1.5. That's why this bug is filed against Graphite.

2) Pip sucks. This is not Graphite's fault :) If there were a way to use yum or RPM (I'm in a Red Hat environment) to install Graphite and support Python packages, I would.

Revision history for this message
Arvind Jayaprakash (anomalizer) wrote :

Adding the SECRET_KEY directive after the "from graphite.app_settings import *" line works.

Revision history for this message
Luke Ashe-Browne (lukeab) wrote :

Hi Folks, comeing up against the same issue, trying to contain my setup inside virtualenv on top of that, and only want to run using the built in test server while i'm developing my setup and for local testing in future.

I uncomment the "from graphite.app_settings import *" and add the SECRET_KEY='xxx_somegeneratedkey=h0-=" line after wards, this is the very last line of the local_settings.py.example copied to local_settings.py

I still get the annoying message :
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

double checking the django that came down from pip install django, is 1.5.1 so i'm expecting your experience to be the same as mine. but i'm not able to get over even this first hurdle.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.