584: ImproperlyConfigured at / Error while importing URLconf 'reviewboard.urls': 'module' object has no attribute 'DEBUG'

nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
Aug. 19, 2008
What's the URL of the page containing the problem?

http://l3-d7015.infinera.com:8000/


What steps will reproduce the problem?
1. Type this url in firefox

What is the expected output? What do you see instead?

I expect to see the dashboard or login screen
I see a page with this
ImproperlyConfigured at /
Error while importing URLconf 'reviewboard.urls': 'module' object has no
attribute 'DEBUG'
Request Method: 	GET
Request URL: 	http://l3-d7015.infinera.com:8000/
Exception Type: 	ImproperlyConfigured
Exception Value: 	Error while importing URLconf 'reviewboard.urls':
'module' object has no attribute 'DEBUG'
Exception Location: 
c:\python25\Lib\site-packages\django\core\urlresolvers.py in
_get_urlconf_module, line 262
Python Executable: 	C:\Program Files\Apache Software
Foundation\Apache2.2\bin\httpd.exe
Python Version: 	2.5.2
Python Path: 	['c:\\Program Files\\Apache Software
Foundation\\Apache2.2\\htdocs', 'c:\\Program Files\\Apache Software
Foundation\\Apache2.2\\htdocs\\reviewboard', 'c:\\Program Files\\Apache
Software Foundation\\Apache2.2\\htdocs\\reviewboard\\djblets',
'C:\\Python25\\lib\\site-packages\\setuptools-0.6c8-py2.5.egg',
'C:\\Python25\\lib\\site-packages\\pygments-0.10-py2.5.egg',
'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\Lib',
'C:\\Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', 'C:\\Program
Files\\Apache Software Foundation\\Apache2.2', 'C:\\Program Files\\Apache
Software Foundation\\Apache2.2\\bin', 'C:\\Python25',
'C:\\Python25\\lib\\site-packages',
'C:\\Python25\\lib\\site-packages\\PIL',
'C:\\Python25\\lib\\site-packages\\win32',
'C:\\Python25\\lib\\site-packages\\win32\\lib',
'C:\\Python25\\lib\\site-packages\\Pythonwin',
'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode']

What operating system are you using? What browser?

windows xp, firefox 3

Please provide any additional information below.
 
I'm using the django alpha 2. also tried the latest from svn.

Thanks,
Nithin.
#1 nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
Traceback:
File "c:\python25\Lib\site-packages\django\core\handlers\base.py" in get_response
  78.                     request.path_info)
File "c:\python25\Lib\site-packages\django\core\urlresolvers.py" in resolve
  240.                     sub_match = pattern.resolve(new_path)
File "c:\python25\Lib\site-packages\django\core\urlresolvers.py" in resolve
  238.             for pattern in self.urlconf_module.urlpatterns:
File "c:\python25\Lib\site-packages\django\core\urlresolvers.py" in _get_urlconf_module
  262.                 raise ImproperlyConfigured, "Error while importing URLconf %r:
%s" % (self.urlconf_name, e)

Exception Type: ImproperlyConfigured at /
Exception Value: Error while importing URLconf 'reviewboard.urls': 'module' object
has no attribute 'DEBUG'
chipx86
#2 chipx86
Did you modify settings.py at any point?

What version of Django are you using?
  • +NeedInfo
#3 nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
No I didn't modify settings.py. As given in the doc, I created settings_local.py.
I've attached my settings.py.

I'm using django alpha 2. Also tried the latest from svn with the same result.

Nithin.
  • +
    # Django settings for reviewboard project.
    import os
    import sys
    DEBUG = True
    ADMINS = (
        ('Example Joe', 'admin@example.com')
    )
    MANAGERS = ADMINS
    # Local time zone for this installation. All choices can be found here:
    # http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
    TIME_ZONE = 'US/Pacific'
    # Language code for this installation. All choices can be found here:
    # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
    # http://blogs.law.harvard.edu/tech/stories/storyReader$15
    LANGUAGE_CODE = 'en-us'
    # This should match the ID of the Site object in the database.  This is used to
    # figure out URLs to stick in e-mails and related pages.
    SITE_ID = 1
    # If you set this to False, Django will make some optimizations so as not
    # to load the internationalization machinery.
    USE_I18N = True
    # List of callables that know how to import templates from various sources.
    TEMPLATE_LOADERS = (
        'django.template.loaders.filesystem.load_t
#4 arena******@gmai***** (Google Code) (Is this you? Claim this profile.)
I've also seen that one yesterday.
The issue is withit reviewboard/djblets/logging/__init__.py
-> logging.DEBUG is unknown there

When using 0 instead of logging.DEBUG the problem disappears.
chipx86
#5 chipx86
Huh. I guess a better question then is which version of Python are you running?
logging.DEBUG should be built-in.
#6 nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
I'm using python 2.5.2. Btw I only see this when running apache. If I run the
manage.py server, it goes fine.
#7 nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
logging.DEBUG is present. btw I dont think this issue is with logging module. This
happens during import of urls I think going by the stack trace.
#8 nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
My modifications to apache httpd.conf 

<VirtualHost *:80>
	ServerName sv-swtools.infinera.com
	DocumentRoot /xampp/htdocs/reviewboard/htdocs

	# Error handlers
	ErrorDocument 500 /errordocs/500.html

	# Serve django pages
	<Location "/">
		PythonPath "[r'c:\python25\lib\site-packages',
r'c:\xampp\htdocs', r'c:\xampp\htdocs\reviewboard',
r'c:\xampp\htdocs\reviewboard\djblets'] + sys.path"
		SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
		SetHandler mod_python
		PythonHandler django.core.handlers.modpython
		PythonAutoReload Off
		PythonDebug Off
		# If you run multiple mod_python sites in the same
apache
		# instonce, uncomment this line:
		# PythonInterpreter reviewboard
	</Location>

	# Serve static media without running it through mod_python
	# (overrides the above)
	<Location "/media">
		SetHandler None
	</Location>
	<Location "/errordocs">
		SetHandler None
	</Location>

	# Alias static media requests to filesystem
	Alias /media reviewboard/htdocs/media
	Alias /errordocs reviewboard/htdocs/errordocs
</VirtualHost>
#9 arena******@gmai***** (Google Code) (Is this you? Claim this profile.)
While logging.DEBUG is definitely present in the python logging module, the error was
really thrown in the djblets.logging module like I said before. As the traceback
shown in the browser did not really hint to the source of the issue, I used the
following steps to get to __init__.py in djblets.loggin:
- set the pythonpath that is set in the apache config as env variable
- also set the DJANGO_SETTINGS_MODULE env variable
- call python directly
- execute "import reviewboard.urls"

And fact is that replacing "logging.DEBUG" with any other value (I used 0 in my case)
solved the problem for my case. Did you try that workaround yet?

Btw. my python version is also 2.5.2. Might it be that the error occurs because the
djblets module and the python module both use the same name "logging" (python
interpreter mixing up things)?
#10 arena******@gmai***** (Google Code) (Is this you? Claim this profile.)
Here's the output from my unfixed test vm:

user@csttestvm:/usr/lib/python2.5/site-packages/django$ export
DJANGO_SETTINGS_MODULE=reviewboard.settings
user@csttestvm:/usr/lib/python2.5/site-packages/django$ export
PYTHONPATH=/usr/lib/python2.5/site-packages/django:/usr/lib/python2.5/site-packages/reviewboard:/usr/lib/python2.5/site-packages/reviewboard/djblets
user@csttestvm:/usr/lib/python2.5/site-packages/django$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import reviewboard.urls
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/reviewboard/urls.py", line 8, in <module>
    from reviewboard.reviews.feeds import RssReviewsFeed, AtomReviewsFeed, \
  File "/usr/lib/python2.5/site-packages/reviewboard/reviews/feeds.py", line 6, in
<module>
    from reviewboard.reviews.models import Group, ReviewRequest
  File "/usr/lib/python2.5/site-packages/reviewboard/reviews/models.py", line 15, in
<module>
    from djblets.util.misc import get_object_or_none
  File "/usr/lib/python2.5/site-packages/reviewboard/djblets/util/misc.py", line 27,
in <module>
    import logging
  File "/usr/lib/python2.5/site-packages/reviewboard/djblets/logging/__init__.py",
line 41, in <module>
    log_beginning=True, default_level=logging.DEBUG):
AttributeError: 'module' object has no attribute 'DEBUG'
#11 nithi******@gmai***** (Google Code) (Is this you? Claim this profile.)
You are right! I should have tried that first. That does fix the problem. 

Thanks. But is this the real way to fix this?
chipx86
#12 chipx86
This should be fixed now in djblets r11835. I've renamed djblets.logging to
djblets.log. You may have to remove the stale *.pyc and logging directory in your
installation.
chipx86
#13 chipx86
  • -NeedInfo
    +Fixed
  • +Djblets