graphite.wsgi : update for django 1.7
Django 1.8 in Xenial hits changes to the app loading made in 1.7 [1]. On Xenail and above, ship a slightly different wsgi loader that uses the new-style loading. [1] https://docs.djangoproject.com/en/dev/releases/1.7/#app-loading-changes Change-Id: Ia741af25391603fe81c0185b586b5841910f714a
This commit is contained in:
parent
2aa06a80e1
commit
977f065a3f
|
@ -259,9 +259,25 @@ class graphite(
|
|||
require => File['/etc/graphite'],
|
||||
}
|
||||
|
||||
# later versions of django require a different wsgi loader; swap it
|
||||
# in here for > trusty
|
||||
case $::operatingsystem {
|
||||
'Ubuntu': {
|
||||
if versioncmp($::operatingsystemrelease, '14.04') <= 0 {
|
||||
$django_wsgi_template = 'graphite.wsgi.erb'
|
||||
}
|
||||
else {
|
||||
$django_wsgi_template = 'graphite.wsgi.django17.erb'
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail('Platform not supported')
|
||||
}
|
||||
}
|
||||
|
||||
file { '/etc/graphite/graphite.wsgi':
|
||||
mode => '0444',
|
||||
content => template('graphite/graphite.wsgi.erb'),
|
||||
content => template("graphite/${django_wsgi_template}"),
|
||||
require => File['/etc/graphite'],
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import os, sys
|
||||
sys.path.append('/var/lib/graphite/webapp')
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings'
|
||||
|
||||
from django.core.wsgi import wsgi_application
|
||||
application = get_wsgi_application()
|
||||
|
||||
# READ THIS
|
||||
# Initializing the search index can be very expensive, please include
|
||||
# the WSGIScriptImport directive pointing to this script in your vhost
|
||||
# config to ensure the index is preloaded before any requests are handed
|
||||
# to the process.
|
||||
from graphite.logger import log
|
||||
log.info("graphite.wsgi - pid %d - reloading search index" % os.getpid())
|
||||
import graphite.metrics.search
|
Loading…
Reference in New Issue