Skip to content

Instantly share code, notes, and snippets.

@GrahamDumpleton
Created November 23, 2012 00:30
Show Gist options
  • Save GrahamDumpleton/4133450 to your computer and use it in GitHub Desktop.
Save GrahamDumpleton/4133450 to your computer and use it in GitHub Desktop.
New Relic version of manage.py.
# Save this as newrelic-manage.py in same directory as existing manage.py.
#
# Run as:
#
# NEW_RELIC_CONFIG_FILE=/some/path/newrelic.ini python newrelic-manage.py run_gunicorn
import os
import newrelic.agent
here = os.path.dirname(__file__)
script = os.path.join(here, 'manage.py')
config = os.environ.get('NEW_RELIC_CONFIG_FILE')
if config:
newrelic.agent.initialize(config)
execfile(script)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment