← Back to team overview

graphite-dev team mailing list archive

[Question #241950]: ImportError: No module named defaults with python27 SCL

 

New question #241950 on Graphite:
https://answers.launchpad.net/graphite/+question/241950

Hi everyone

I am new user to graphite and i don't know python.

My goal is to build CentOS rpms for graphite family. I also want to use python27 from RedHat(and now CentOS) Software collection. Using python from software collection is mandatory in my case.

Briefly: i am running graphite-web development server and once it got a request, it reports this message: ImportError: No module named defaults

The long story follows.
BACKGROUND
Software collections (SCL) is the way to have as many concurent versions of software as i want in CentOS . In my case i have standard python2.6 which is heavily used by centos packaging system and is hard to replace in production. With SCL i can use python33 or python27 for any single program i want. For example, when i build graphite-web, i am running command
scl enable python27 'python check-dependencies.py'; python binary is found via modified environment variables, and python2.7 will be default.

STORY
I built some rpms for python27 libraries which are required by carbon and graphite-web
I have python27-pithon-django for example, as well as whisper, carbon, uwsgi, twisted, etc
I was able to run carbon under python27 and it seems to work fine and accept data.
Then i faced with problems running graphite-web via uwsgi. Going deeper and deeper i aned up with a clean Centos 6.5 chrooted environment where i install my packages and building graphite-web from source.

I am using latest version available, 0.9.12.  scl enable python27 'python check-dependencies.py' said i have no fatal problems.
Then i install graphite-web with  

scl enable python27 'python setup.py install'

Here is my changes to config, i only set SECRET_KEY:
diff -u local_settings.py.example local_settings.py 
--- local_settings.py.example	2013-08-22 22:36:04.000000000 +0400
+++ local_settings.py	2014-01-09 13:11:39.956498364 +0400
@@ -10,7 +10,7 @@
 # install. This key is used for salting of hashes used in auth tokens,
 # CRSF middleware, cookie storage, etc. This should be set identically among
 # instances if used behind a load balancer.
-#SECRET_KEY = 'UNSAFE_DEFAULT'
+SECRET_KEY = '3ufosjdfeu89r43ur9jrfldsjoigud9u'
 
 # In Django 1.5+ set this to the list of hosts your graphite instances is
 # accessible as. See:

Next, i am running devel server with 

scl enable python27 '/opt/graphite/bin/run-graphite-devel-server.py --port 32770 /opt/graphite'

And here is the output after one request sent

Running Graphite from /opt/graphite under django development server

/opt/rh/python27/root/usr/bin/django-admin runserver --pythonpath /opt/graphite/webapp --settings graphite.settings 0.0.0.0:32770
Validating models...

0 errors found
January 09, 2014 - 03:12:01
Django version 1.6.1, using settings 'graphite.settings'
Starting development server at http://0.0.0.0:32770/
Quit the server with CONTROL-C.
	Traceback (most recent call last):
  File "/opt/rh/python27/root/usr/lib64/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 206, in __call__
    response = self.get_response(request)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 196, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 234, in handle_uncaught_exception
    if resolver.urlconf_module is None:
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/core/urlresolvers.py", line 341, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/opt/graphite/webapp/graphite/urls.py", line 15, in <module>
    from django.conf.urls.defaults import *
ImportError: No module named defaults
[09/Jan/2014 03:12:04] "GET / HTTP/1.0" 500 59
Traceback (most recent call last):
  File "/opt/rh/python27/root/usr/lib64/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 206, in __call__
    response = self.get_response(request)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 196, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 234, in handle_uncaught_exception
    if resolver.urlconf_module is None:
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/core/urlresolvers.py", line 341, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/opt/graphite/webapp/graphite/urls.py", line 15, in <module>
    from django.conf.urls.defaults import *
ImportError: No module named defaults


And now i have no idea where to look information on how to handle this problem.

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.