Skip to content

Instantly share code, notes, and snippets.

@deniszh
Created February 24, 2016 22:25
Show Gist options
  • Select an option

  • Save deniszh/133befd85d2e5ada2de4 to your computer and use it in GitHub Desktop.

Select an option

Save deniszh/133befd85d2e5ada2de4 to your computer and use it in GitHub Desktop.
import os
import sys
sys.path.append('/opt/graphite/webapp')
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphite.settings') # noqa
from django.conf import settings
from django.core.wsgi import get_wsgi_application
from graphite.logger import log
application = get_wsgi_application()
# Initializing the search index can be very expensive. The import below
# ensures the index is preloaded before any requests are handed to the
# process.
log.info("graphite.wsgi - pid %d - reloading search index" % os.getpid())
import graphite.metrics.search # noqa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment