584: ImproperlyConfigured at / Error while importing URLconf 'reviewboard.urls': 'module' object has no attribute 'DEBUG'
- Fixed
- Review Board
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.
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'
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.
-
+
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.
Huh. I guess a better question then is which version of Python are you running? logging.DEBUG should be built-in.
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.
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.
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>
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)?
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'
You are right! I should have tried that first. That does fix the problem. Thanks. But is this the real way to fix this?
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.