123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- """
- Django settings for glitchtip project.
- Generated by 'django-admin startproject' using Django 3.0rc1.
- For more information on this file, see
- https://docs.djangoproject.com/en/dev/topics/settings/
- For the full list of settings and their values, see
- https://docs.djangoproject.com/en/dev/ref/settings/
- """
- import os
- import environ
- import sentry_sdk
- from sentry_sdk.integrations.django import DjangoIntegration
- env = environ.Env(
- DEBUG=(bool, True),
- DEBUG_TOOLBAR=(bool, False),
- AWS_ACCESS_KEY_ID=(str, None),
- AWS_SECRET_ACCESS_KEY=(str, None),
- AWS_STORAGE_BUCKET_NAME=(str, None),
- AWS_S3_ENDPOINT_URL=(str, None),
- AWS_LOCATION=(str, None),
- STATIC_URL=(str, "/static/"),
- STATICFILES_STORAGE=(
- str,
- "whitenoise.storage.CompressedManifestStaticFilesStorage",
- ),
- )
- path = environ.Path()
- # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
- BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- # Quick-start development settings - unsuitable for production
- # See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
- # SECURITY WARNING: keep the secret key used in production secret!
- SECRET_KEY = env("SECRET_KEY")
- # SECURITY WARNING: don't run with debug turned on in production!
- DEBUG = env("DEBUG")
- ALLOWED_HOSTS = ["*"]
- GLITCHTIP_ENDPOINT = env.url("GLITCHTIP_ENDPOINT", default="http://localhost:8000")
- sentry_sdk.init(
- dsn="http://9c31decfd46843ffb3c0ea548b71aafc@192.168.86.139:8000/1",
- integrations=[DjangoIntegration()],
- )
- def show_toolbar(request):
- return env("DEBUG_TOOLBAR")
- DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": show_toolbar}
- # Application definition
- INSTALLED_APPS = [
- "django.contrib.auth",
- "django.contrib.contenttypes",
- "django.contrib.sessions",
- "django.contrib.messages",
- "django.contrib.staticfiles",
- "django.contrib.sites",
- "allauth",
- "allauth.account",
- "corsheaders",
- "debug_toolbar",
- "rest_framework",
- "rest_framework.authtoken",
- "rest_auth",
- "storages",
- "organizations",
- "issues",
- "users",
- "projects",
- ]
- MIDDLEWARE = [
- "django.middleware.security.SecurityMiddleware",
- "django.contrib.sessions.middleware.SessionMiddleware",
- "corsheaders.middleware.CorsMiddleware",
- "django.middleware.clickjacking.XFrameOptionsMiddleware",
- "whitenoise.middleware.WhiteNoiseMiddleware",
- "debug_toolbar.middleware.DebugToolbarMiddleware",
- "django.middleware.common.CommonMiddleware",
- "django.middleware.csrf.CsrfViewMiddleware",
- "django.contrib.auth.middleware.AuthenticationMiddleware",
- "django.contrib.messages.middleware.MessageMiddleware",
- "django.middleware.clickjacking.XFrameOptionsMiddleware",
- "glitchtip.middleware.proxy.DecompressBodyMiddleware",
- ]
- ROOT_URLCONF = "glitchtip.urls"
- TEMPLATES = [
- {
- "BACKEND": "django.template.backends.django.DjangoTemplates",
- "DIRS": [path("dist")],
- "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 = "glitchtip.wsgi.application"
- CORS_ORIGIN_ALLOW_ALL = env.bool("CORS_ORIGIN_ALLOW_ALL", True)
- CORS_ORIGIN_WHITELIST = env.tuple("CORS_ORIGIN_WHITELIST", str, default=())
- X_FRAME_OPTIONS = "DENY"
- SECURE_BROWSER_XSS_FILTER = True
- SECURE_CONTENT_TYPE_NOSNIFF = True
- ENVIRONMENT = env.str("ENVIRONMENT", None)
- GLITCH_VERSION = env.str("PASSIT_VERSION", "dev")
- # Database
- # https://docs.djangoproject.com/en/dev/ref/settings/#databases
- DATABASES = {"default": env.db(default="postgres://postgres:postgres@db:5432/postgres")}
- # Password validation
- # https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
- 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",},
- ]
- # Internationalization
- # https://docs.djangoproject.com/en/dev/topics/i18n/
- LANGUAGE_CODE = "en-us"
- TIME_ZONE = "UTC"
- USE_I18N = True
- USE_L10N = True
- USE_TZ = True
- SITE_ID = 1
- # Static files (CSS, JavaScript, Images)
- # https://docs.djangoproject.com/en/dev/howto/static-files/
- STATIC_URL = env("STATIC_URL")
- AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID")
- AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY")
- AWS_STORAGE_BUCKET_NAME = env("AWS_STORAGE_BUCKET_NAME")
- AWS_S3_ENDPOINT_URL = env("AWS_S3_ENDPOINT_URL")
- AWS_LOCATION = env("AWS_LOCATION")
- STATICFILES_DIRS = [
- "dist",
- ]
- STATIC_ROOT = path("static/")
- STATICFILES_STORAGE = env("STATICFILES_STORAGE")
- EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
- AUTH_USER_MODEL = "users.User"
- ACCOUNT_AUTHENTICATION_METHOD = "email"
- ACCOUNT_EMAIL_REQUIRED = True
- ACCOUNT_USERNAME_REQUIRED = False
- AUTHENTICATION_BACKENDS = (
- # Needed to login by username in Django admin, regardless of `allauth`
- "django.contrib.auth.backends.ModelBackend",
- # `allauth` specific authentication methods, such as login by e-mail
- "allauth.account.auth_backends.AuthenticationBackend",
- )
- REST_FRAMEWORK = {
- "DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated",],
- "DEFAULT_PAGINATION_CLASS": "glitchtip.pagination.LinkHeaderPagination",
- "PAGE_SIZE": 50,
- }
|