New Installation Problem: NameError at / name 'patterns' is not defined

Asked by Fred Owsley

I'm getting an Error 500 in the middle of my first graphite installation:

Ubuntu 12.04 LTS
package python 2.7.3
package django 1.3.1
package apache2 2.2.22
package wgsi 3.3-4

graphite, ceres, whisper from github

/opt/graphite/ is owned by www-data:www-data

last entry in /opt/graphite/storage/log/webapp/error.log:
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] NameError: name 'patterns' is not defined
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] mod_wsgi (pid=2541): Exception occurred processing WSGI script '/opt/graphite/conf/graphite.wsgi'.
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] Traceback (most recent call last):
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 272, in __call__
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] response = self.get_response(request)
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 169, in get_response
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 214, in handle_uncaught_exception
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] if resolver.urlconf_module is None:
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 274, in _get_urlconf_module
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] self._urlconf_module = import_module(self.urlconf_name)
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] __import__(name)
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] File "/opt/graphite/webapp/graphite/urls.py", line 21, in <module>
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] urlpatterns = patterns('',
[Thu Oct 17 14:15:24 2013] [error] [client 10.1.1.96] NameError: name 'patterns' is not defined

500 Error with Debug = TRUE
***paste from Web Browser***

NameError at /
name 'patterns' is not defined
Request Method: GET
Request URL: http://10.1.1.226/
Django Version: 1.3.1
Exception Type: NameError
Exception Value:
name 'patterns' is not defined
Exception Location: /opt/graphite/webapp/graphite/urls.py in <module>, line 21
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path:
['/opt/graphite/webapp',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/opt/graphite/webapp']
Server time: Thu, 17 Oct 2013 15:16:50 -0400
Traceback Switch to copy-and-paste view

/usr/lib/python2.7/dist-packages/django/core/handlers/base.py in get_response
                            request.path_info) ...
▶ Local vars
/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py in resolve
            for pattern in self.url_patterns: ...
▶ Local vars
/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py in _get_url_patterns
        patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ...
▶ Local vars
/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py in _get_urlconf_module
            self._urlconf_module = import_module(self.urlconf_name) ...
▶ Local vars
/usr/lib/python2.7/dist-packages/django/utils/importlib.py in import_module
    __import__(name) ...
▶ Local vars
/opt/graphite/webapp/graphite/urls.py in <module>
urlpatterns = patterns('', ...
▶ Local vars
Request information

GET
No GET data
POST
No POST data
FILES
No FILES data
COOKIES
No cookie data
META
Variable Value
mod_wsgi.listener_port
'80'
mod_wsgi.listener_host
''
SERVER_SOFTWARE
'Apache/2.2.22 (Ubuntu)'
SCRIPT_NAME
u''
mod_wsgi.handler_script
''
SERVER_SIGNATURE
'<address>Apache/2.2.22 (Ubuntu) Server at 10.1.1.226 Port 80</address>\n'
REQUEST_METHOD
'GET'
PATH_INFO
u'/'
SERVER_PROTOCOL
'HTTP/1.1'
QUERY_STRING
''
HTTP_USER_AGENT
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36'
HTTP_CONNECTION
'keep-alive'
SERVER_NAME
'10.1.1.226'
REMOTE_ADDR
'10.1.1.96'
mod_wsgi.request_handler
'wsgi-script'
wsgi.url_scheme
'http'
PATH_TRANSLATED
'/opt/graphite/conf/graphite.wsgi/'
SERVER_PORT
'80'
wsgi.multiprocess
True
mod_wsgi.input_chunked
'0'
SERVER_ADDR
'10.1.1.226'
DOCUMENT_ROOT
'/opt/graphite/webapp'
mod_wsgi.process_group
'graphite'
SCRIPT_FILENAME
'/opt/graphite/conf/graphite.wsgi'
SERVER_ADMIN
'[no address given]'
wsgi.input
<mod_wsgi.Input object at 0x7f99ed6caab0>
HTTP_DNT
'1'
HTTP_HOST
'10.1.1.226'
wsgi.multithread
True
mod_wsgi.callable_object
'application'
HTTP_CACHE_CONTROL
'max-age=0'
REQUEST_URI
'/'
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
wsgi.version
(1, 1)
GATEWAY_INTERFACE
'CGI/1.1'
wsgi.run_once
False
wsgi.errors
<mod_wsgi.Log object at 0x7f99edd08ab0>
REMOTE_PORT
'61366'
HTTP_ACCEPT_LANGUAGE
'en-US,en;q=0.8'
mod_wsgi.version
(3, 3)
mod_wsgi.application_group
''
mod_wsgi.script_reloading
'1'
wsgi.file_wrapper
''
HTTP_ACCEPT_ENCODING
'gzip,deflate,sdch'
Settings
Using settings module graphite.settings
Setting Value
REMOTE_RENDERING
False
REMOTE_FETCH_TIMEOUT
6.0
EMAIL_USE_TLS
False
TIME_ZONE
'America/New_York'
DOCUMENTATION_URL
'http://graphite.readthedocs.org/'
LDAP_URI
None
LANGUAGE_CODE
'en-us'
ROOT_URLCONF
'graphite.urls'
MANAGERS
()
CARBONLINK_TIMEOUT
1.0
GRAPHITE_ROOT
'/opt/graphite'
CLUSTER_SERVERS
[]
DEFAULT_CHARSET
'utf-8'
WEBAPP_DIR
'/opt/graphite/webapp'
STATIC_ROOT
''
TEST_DATABASE_CHARSET
None
CARBONLINK_RETRY_DELAY
15
ALLOWED_HOSTS
['*']
REMOTE_RENDER_CONNECT_TIMEOUT
1.0
MESSAGE_STORAGE
'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'
DATABASE_HOST
''
EMAIL_SUBJECT_PREFIX
'[Django] '
SEND_BROKEN_LINK_EMAILS
False
URL_VALIDATOR_USER_AGENT
'Django/1.3.1 (http://www.djangoproject.com)'
CONF_DIR
'/opt/graphite/conf'
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_NAME
'sessionid'
LDAP_BASE_USER
''
REMOTE_READER_CACHE_SIZE_LIMIT
1000
ADMIN_FOR
()
TIME_INPUT_FORMATS
('%H:%M:%S', '%H:%M')
REPLICATION_FACTOR
1
DATABASES
{'default': {'ENGINE': 'django.db.backends.sqlite3',
             'HOST': '',
             'NAME': '/opt/graphite/storage/graphite.db',
             'OPTIONS': {},
             'PASSWORD': '********************',
             'PORT': '',
             'TEST_CHARSET': None,
             'TEST_COLLATION': None,
             'TEST_MIRROR': None,
             'TEST_NAME': None,
             'TIME_ZONE': 'America/New_York',
             'USER': ''}}
LDAP_USE_TLS
False
FILE_UPLOAD_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
('django.core.files.uploadhandler.MemoryFileUploadHandler',
 'django.core.files.uploadhandler.TemporaryFileUploadHandler')
LOG_CACHE_PERFORMANCE
False
DEFAULT_CONTENT_TYPE
'text/html'
TEST_RUNNER
'django.test.simple.DjangoTestSuiteRunner'
APPEND_SLASH
False
FIRST_DAY_OF_WEEK
0
DATABASE_ROUTERS
[]
CARBONLINK_HOSTS
['127.0.0.1:7002']
YEAR_MONTH_FORMAT
'F Y'
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
             'LOCATION': ''}}
CSS_DIR
'/opt/graphite/webapp/content/css'
LEGEND_MAX_ITEMS
10
SERVER_EMAIL
'root@localhost'
SESSION_COOKIE_PATH
'/'
USE_X_FORWARDED_HOST
False
FIND_TOLERANCE
600
IGNORABLE_404_ENDS
('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')
MIDDLEWARE_CLASSES
('django.middleware.common.CommonMiddleware',
 'django.middleware.gzip.GZipMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')
USE_I18N
True
LDAP_USER_QUERY
''
SECRET_KEY
'********************'
LANGUAGE_COOKIE_NAME
'django_language'
USE_REMOTE_USER_AUTHENTICATION
False
FILE_UPLOAD_TEMP_DIR
None
LDAP_SEARCH_BASE
''
TRANSACTIONS_MANAGED
False
LOGGING_CONFIG
'django.utils.log.dictConfig'
TEMPLATE_LOADERS
('django.template.loaders.filesystem.Loader',
 'django.template.loaders.app_directories.Loader')
LOG_DIR
'/opt/graphite/storage/log/webapp'
TEMPLATE_DEBUG
False
CSRF_COOKIE_NAME
'csrftoken'
TEST_DATABASE_COLLATION
None
FORCE_SCRIPT_NAME
None
CACHE_BACKEND
'dummy:///'
DASHBOARD_REQUIRE_AUTHENTICATION
False
LDAP_PORT
389
SESSION_COOKIE_SECURE
False
LDAP_BASE_PASS
''
JAVASCRIPT_DEBUG
False
CSRF_COOKIE_DOMAIN
None
FILE_CHARSET
'utf-8'
DEBUG
True
CERES_DIR
'/opt/graphite/storage/ceres/'
SESSION_FILE_PATH
None
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
INSTALLED_APPS
['graphite.metrics',
 'graphite.render',
 'graphite.cli',
 'graphite.browser',
 'graphite.composer',
 'graphite.account',
 'graphite.dashboard',
 'graphite.whitelist',
 'graphite.events',
 'django.contrib.auth',
 'django.contrib.sessions',
 'django.contrib.admin',
 'django.contrib.contenttypes',
 'tagging']
LANGUAGES_BIDI
('he', 'ar', 'fa')
USE_L10N
False
DATABASE_ENGINE
'django.db.backends.sqlite3'
DATABASE_NAME
'/opt/graphite/storage/graphite.db'
COMMENTS_FIRST_FEW
0
PREPEND_WWW
False
SESSION_COOKIE_HTTPONLY
False
DATABASE_PORT
''
DEBUG_PROPAGATE_EXCEPTIONS
False
INDEX_FILE
'/opt/graphite/storage/index'
MONTH_DAY_FORMAT
'F j'
LOGIN_URL
'/account/login'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
STANDARD_DIRS
['/opt/graphite/storage/whisper/', '/opt/graphite/storage/rrd/']
LDAP_SERVER
''
TIME_FORMAT
'P'
MEMCACHE_HOSTS
[]
DATE_INPUT_FORMATS
('%Y-%m-%d',
 '%m/%d/%Y',
 '%m/%d/%y',
 '%b %d %Y',
 '%b %d, %Y',
 '%d %b %Y',
 '%d %b, %Y',
 '%B %d %Y',
 '%B %d, %Y',
 '%d %B %Y',
 '%d %B, %Y')
GRAPHITE_WEB_APP_SETTINGS_LOADED
True
CONTENT_DIR
'/opt/graphite/webapp/content'
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
EMAIL_HOST_PASSWORD
'********************'
CARBONLINK_HASHING_KEYFUNC
None
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
CACHE_MIDDLEWARE_ALIAS
'default'
SESSION_SAVE_EVERY_REQUEST
False
ADMIN_MEDIA_PREFIX
'/media/'
NUMBER_GROUPING
0
SESSION_ENGINE
'django.contrib.sessions.backends.db'
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
COMMENTS_SKETCHY_USERS_GROUP
None
LOGIN_REDIRECT_URL
'/accounts/profile/'
FLUSHRRDCACHED
''
DECIMAL_SEPARATOR
'.'
FIND_CACHE_DURATION
300
CACHE_MIDDLEWARE_KEY_PREFIX
''
LOCALE_PATHS
()
WHITELIST_FILE
'/opt/graphite/storage/lists/whitelist'
TEMPLATE_STRING_IF_INVALID
''
COMMENTS_ALLOW_PROFANITIES
False
LOGOUT_URL
'/accounts/logout/'
STORAGE_DIR
'/opt/graphite/storage'
DASHBOARD_CONF
'/opt/graphite/conf/dashboard.conf'
TEMPLATE_DIRS
('/opt/graphite/webapp/graphite/templates',)
RRD_DIR
'/opt/graphite/storage/rrd/'
FIXTURE_DIRS
()
EMAIL_HOST
'localhost'
DATE_FORMAT
'N j, Y'
MEDIA_ROOT
''
COMMENTS_MODERATORS_GROUP
None
ADMINS
()
LOG_METRIC_ACCESS
False
FORMAT_MODULE_PATH
None
DEFAULT_FROM_EMAIL
'webmaster@localhost'
THOUSAND_SEPARATOR
','
WEB_DIR
'/opt/graphite/webapp/graphite'
STATICFILES_DIRS
()
MEDIA_URL
''
DATETIME_FORMAT
'N j, Y, P'
IGNORABLE_404_STARTS
('/cgi-bin/', '/_vti_bin', '/_vti_inf')
DJANGO_VERSION
(1, 3, 1, 'final', 0)
REMOTE_FIND_TIMEOUT
3.0
SITE_ID
1
DISALLOWED_USER_AGENTS
()
ALLOWED_INCLUDE_ROOTS
()
USE_THOUSAND_SEPARATOR
False
USE_LDAP_AUTH
False
LOGGING
{'disable_existing_loggers': False,
 'handlers': {'mail_admins': {'class': 'django.utils.log.AdminEmailHandler',
                              'level': 'ERROR'}},
 'loggers': {'django.request': {'handlers': ['mail_admins'],
                                'level': 'ERROR',
                                'propagate': True}},
 'version': 1}
SHORT_DATE_FORMAT
'm/d/Y'
DATABASE_USER
''
TEST_DATABASE_NAME
None
RRD_CF
'AVERAGE'
WEBAPP_VERSION
'0.10.0-alpha'
STATICFILES_FINDERS
('django.contrib.staticfiles.finders.FileSystemFinder',
 'django.contrib.staticfiles.finders.AppDirectoriesFinder')
SMTP_SERVER
'localhost'
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
WHISPER_DIR
'/opt/graphite/storage/whisper/'
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
DEFAULT_TABLESPACE
''
TEMPLATE_CONTEXT_PROCESSORS
('django.contrib.auth.context_processors.auth',
 'django.core.context_processors.debug',
 'django.core.context_processors.i18n',
 'django.core.context_processors.media',
 'django.core.context_processors.static',
 'django.contrib.messages.context_processors.messages')
RENDERING_HOSTS
[]
ALLOW_ANONYMOUS_CLI
True
SESSION_COOKIE_AGE
1209600
SETTINGS_MODULE
'graphite.settings'
USE_ETAGS
False
DEFAULT_CACHE_DURATION
60
LANGUAGES
(('ar', 'Arabic'),
 ('az', 'Azerbaijani'),
 ('bg', 'Bulgarian'),
 ('bn', 'Bengali'),
 ('bs', 'Bosnian'),
 ('ca', 'Catalan'),
 ('cs', 'Czech'),
 ('cy', 'Welsh'),
 ('da', 'Danish'),
 ('de', 'German'),
 ('el', 'Greek'),
 ('en', 'English'),
 ('en-gb', 'British English'),
 ('es', 'Spanish'),
 ('es-ar', 'Argentinian Spanish'),
 ('es-mx', 'Mexican Spanish'),
 ('es-ni', 'Nicaraguan Spanish'),
 ('et', 'Estonian'),
 ('eu', 'Basque'),
 ('fa', 'Persian'),
 ('fi', 'Finnish'),
 ('fr', 'French'),
 ('fy-nl', 'Frisian'),
 ('ga', 'Irish'),
 ('gl', 'Galician'),
 ('he', 'Hebrew'),
 ('hi', 'Hindi'),
 ('hr', 'Croatian'),
 ('hu', 'Hungarian'),
 ('id', 'Indonesian'),
 ('is', 'Icelandic'),
 ('it', 'Italian'),
 ('ja', 'Japanese'),
 ('ka', 'Georgian'),
 ('km', 'Khmer'),
 ('kn', 'Kannada'),
 ('ko', 'Korean'),
 ('lt', 'Lithuanian'),
 ('lv', 'Latvian'),
 ('mk', 'Macedonian'),
 ('ml', 'Malayalam'),
 ('mn', 'Mongolian'),
 ('nl', 'Dutch'),
 ('no', 'Norwegian'),
 ('nb', 'Norwegian Bokmal'),
 ('nn', 'Norwegian Nynorsk'),
 ('pa', 'Punjabi'),
 ('pl', 'Polish'),
 ('pt', 'Portuguese'),
 ('pt-br', 'Brazilian Portuguese'),
 ('ro', 'Romanian'),
 ('ru', 'Russian'),
 ('sk', 'Slovak'),
 ('sl', 'Slovenian'),
 ('sq', 'Albanian'),
 ('sr', 'Serbian'),
 ('sr-latn', 'Serbian Latin'),
 ('sv', 'Swedish'),
 ('ta', 'Tamil'),
 ('te', 'Telugu'),
 ('th', 'Thai'),
 ('tr', 'Turkish'),
 ('uk', 'Ukrainian'),
 ('ur', 'Urdu'),
 ('vi', 'Vietnamese'),
 ('zh-cn', 'Simplified Chinese'),
 ('zh-tw', 'Traditional Chinese'))
DEFAULT_INDEX_TABLESPACE
''
INTERNAL_IPS
()
STATIC_URL
None
EMAIL_PORT
25
LOG_RENDERING_PERFORMANCE
False
DASHBOARD_REQUIRE_EDIT_GROUP
None
SHORT_DATETIME_FORMAT
'm/d/Y P'
REMOTE_RETRY_DELAY
60.0
ABSOLUTE_URL_OVERRIDES
{}
DATABASE_OPTIONS
{}
CACHE_MIDDLEWARE_SECONDS
600
BANNED_IPS
()
DASHBOARD_REQUIRE_PERMISSIONS
False
DATETIME_INPUT_FORMATS
('%Y-%m-%d %H:%M:%S',
 '%Y-%m-%d %H:%M',
 '%Y-%m-%d',
 '%m/%d/%Y %H:%M:%S',
 '%m/%d/%Y %H:%M',
 '%m/%d/%Y',
 '%m/%d/%y %H:%M:%S',
 '%m/%d/%y %H:%M',
 '%m/%d/%y')
DATABASE_PASSWORD
'********************'
GRAPHTEMPLATES_CONF
'/opt/graphite/conf/graphTemplates.conf'
PROFANITIES_LIST
'********************'
EMAIL_HOST_USER
''
COMMENTS_BANNED_USERS_GROUP
None

Question information

Language:
English Edit question
Status:
Answered
For:
Graphite Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Martin Pels (martin-rodecker) said :
#1

This appears to have been caused by https://github.com/graphite-project/graphite-web/commit/fc3f018544c19b90cc63797d18970a4cc27ef2ad#diff-a4d0ec3654c07a600b09d46705b38d9f

Changing 'django.conf.urls' back to 'django.conf.urls.defaults' fixes the error.

Can you help with this problem?

Provide an answer of your own, or ask Fred Owsley for more information if necessary.

To post a message you must log in.