Inspired by: http://eldarion.com/blog/2013/02/14/entry-point-hook-django-projects/ Moves startup code to lms.startup and cms.startup, and calls the startup methods in wsgi.py and manage.py for both projects.
13 lines
397 B
Python
13 lines
397 B
Python
from django.conf import settings
|
|
from dogapi import dog_http_api, dog_stats_api
|
|
|
|
def run():
|
|
"""
|
|
Initialize connection to datadog during django startup.
|
|
|
|
Expects the datadog api key in the DATADOG_API settings key
|
|
"""
|
|
if hasattr(settings, 'DATADOG_API'):
|
|
dog_http_api.api_key = settings.DATADOG_API
|
|
dog_stats_api.start(api_key=settings.DATADOG_API, statsd=True)
|