fixed new relic app name

The app name wasn't displayed correctly on the new relic dashboard.

Although `NEW_RELIC_APP_NAME` was set in `production.py`, the variable was not loaded *before* the newrelic agent was called.

Since the new relic agent is loaded at a very low level, NEW_RELIC_APP_NAME has to be set before django settings are imported.
This commit is contained in:
Jay 2016-01-26 17:04:59 +01:00
parent 1722d461b3
commit 9a2f72773a
4 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,10 @@
All enhancements and patches to cookiecutter-django will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2016-1-26]
### Changed
- Fixed NEW_RELIC_APP_NAME environment variable (@jayfk)
## [2016-1-18]
### Added
- Added .dockerignore file (@bogdal)

View File

@ -40,6 +40,7 @@ DJANGO_SENTRY_CLIENT SENTRY_CLIENT n/a
DJANGO_SENTRY_LOG_LEVEL SENTRY_LOG_LEVEL n/a logging.INFO
DJANGO_MAILGUN_API_KEY MAILGUN_ACCESS_KEY n/a raises error
DJANGO_MAILGUN_SERVER_NAME MAILGUN_SERVER_NAME n/a raises error
NEW_RELIC_APP_NAME NEW_RELIC_APP_NAME n/a raises error
NEW_RELIC_LICENSE_KEY NEW_RELIC_LICENSE_KEY n/a raises error
DJANGO_OPBEAT_APP_ID OPBEAT['APP_ID'] n/a raises error
DJANGO_OPBEAT_SECRET_TOKEN OPBEAT['SECRET_TOKEN'] n/a raises error
@ -51,4 +52,4 @@ Other Settings
--------------
ACCOUNT_ALLOW_REGISTRATION (=True)
Allow enable or disable user registration through `django-allauth` without disabling other characteristics like authentication and account management.
Allow enable or disable user registration through `django-allauth` without disabling other characteristics like authentication and account management.

View File

@ -147,7 +147,7 @@ EMAIL_SUBJECT_PREFIX = env("DJANGO_EMAIL_SUBJECT_PREFIX", default='[{{cookiecutt
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
{% if cookiecutter.use_newrelic == 'y'-%}
NEW_RELIC_LICENSE_KEY = env('NEW_RELIC_LICENSE_KEY')
NEW_RELIC_APP_NAME = '{{cookiecutter.project_name}}'
NEW_RELIC_APP_NAME = env('NEW_RELIC_APP_NAME')
{%- endif %}
# TEMPLATE CONFIGURATION

View File

@ -16,7 +16,8 @@ DJANGO_SECURE_SSL_REDIRECT=False
DJANGO_SENTRY_DSN=
{% endif %}
{% if cookiecutter.use_newrelic == 'y' -%}
NEW_RELIC_LICENSE_KEY
NEW_RELIC_LICENSE_KEY=
NEW_RELIC_APP_NAME={{cookiecutter.repo_name}}
{% endif %}
{% if cookiecutter.use_opbeat == 'y' -%}
DJANGO_OPBEAT_ORGANIZATION_ID