Created
May 14, 2020 01:19
-
-
Save burnsie7/266e459f5e23ca9583e8c1ef461fb876 to your computer and use it in GitHub Desktop.
basic django settings.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
SECRET_KEY = 'redacted' | |
DEBUG = False | |
ALLOWED_HOSTS = ['localhost', '127.0.0.1', '[::1]'] | |
INSTALLED_APPS = [ | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
] | |
MIDDLEWARE = [ | |
'django.middleware.security.SecurityMiddleware', | |
'django.contrib.sessions.middleware.SessionMiddleware', | |
'django.middleware.common.CommonMiddleware', | |
'django.middleware.csrf.CsrfViewMiddleware', | |
'django.contrib.auth.middleware.AuthenticationMiddleware', | |
'django.contrib.messages.middleware.MessageMiddleware', | |
'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
] | |
ROOT_URLCONF = 'mysite.urls' | |
TEMPLATES = [ | |
{ | |
'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
'DIRS': [], | |
'APP_DIRS': True, | |
'OPTIONS': { | |
'context_processors': [ | |
'django.template.context_processors.debug', | |
'django.template.context_processors.request', | |
'django.contrib.auth.context_processors.auth', | |
'django.contrib.messages.context_processors.messages', | |
], | |
}, | |
}, | |
] | |
WSGI_APPLICATION = 'mysite.wsgi.application' | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
} | |
} | |
AUTH_PASSWORD_VALIDATORS = [ | |
{ | |
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | |
}, | |
{ | |
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | |
}, | |
] | |
LANGUAGE_CODE = 'en-us' | |
TIME_ZONE = 'UTC' | |
USE_I18N = True | |
USE_L10N = True | |
USE_TZ = True | |
STATIC_URL = '/static/' | |
from ddtrace import config, tracer | |
tracer.configure(hostname='localhost', port=8126, enabled=True) | |
config.django['service_name'] = 'my-django-app' | |
config.django['cache_service_name'] = 'my-cache' | |
config.django['database_service_name_prefix'] = 'my-' | |
config.django['instrument_databases'] = True | |
config.django['instrument_caches'] = True | |
config.django['trace_query_string'] = True | |
config.django['analytics_enabled'] = True | |
config.django['analytics_sample_rate'] = 0.5 | |
tracer.set_tags({'env': 'sandbox'}) | |
from ddtrace import patch_all | |
import django | |
patch_all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment