Ejemplo n.º 1
0
"""
Django settings for new_app_16196 project.

Generated by 'django-admin startproject' using Django 2.2.2.

For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

import os
import environ

env = environ.Env()

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DEBUG", default=False)

# 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/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str("SECRET_KEY")

ALLOWED_HOSTS = env.list("HOST", default=["*"])
Generated by 'django-admin startproject' using Django 3.0.4.

For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os
from pathlib import Path

import environ

env = environ.Env(
    # set casting, default value
    DEBUG=(bool, False), )
environ.Env.read_env()

# Build paths inside the project like this: BASE_DIR / ...
BASE_DIR = Path(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

MEDIA_ROOT = BASE_DIR / 'media'
MEDIA_URL = '/media/'

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')
Ejemplo n.º 3
0
# ROOT_DIR = environ.Path(__file__) - 2
ROOT_DIR = environ.Path(__file__) - 2
APPS_DIR = ROOT_DIR.path('apps')
# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

sys.path.append(APPS_DIR.root)

# region os environment variables
env = environ.Env(
    DJANGO_DEBUG=(bool, False),
    DJANGO_EXPOSE_DOCS=(bool, True),
    DJANGO_SECRET_KEY=(str, 'CHANGE_ME_LOL!!!'),
    DJANGO_ADMINS=(list, []),
    DJANGO_ALLOWED_HOSTS=(list, []),
    DJANGO_STATIC_ROOT=(str, APPS_DIR.path('staticfiles').root),
    DJANGO_MEDIA_ROOT=(str, APPS_DIR.path('media').root),
    DJANGO_DATABASE_URL=(str, 'postgres:///test'),
    DJANGO_USE_DEBUG_TOOLBAR=(bool, False),
    DJANGO_USE_DEBUG_PANEL=(bool, False),
    DJANGO_TEST_RUN=(bool, False),
    DJANGO_TEST_LOGS=(bool, False),
    DJANGO_SYS_LOG_ENABLE=(bool, False),
    DJANGO_CORS_ORIGIN_WHITELIST=(list, []),
)

environ.Env.read_env()

ADMIN_URL = 'admin/'

DEBUG = env.bool('DJANGO_DEBUG')
SYS_LOG_ENABLE = env.bool('DJANGO_SYS_LOG_ENABLE')
Ejemplo n.º 4
0
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""

import os

from django.contrib.messages import constants as messages

import environ

__root__ = environ.Path(__file__) - 3  # three folder back (/a/b/c/ - 3 = /)
# set default values and casting
__env__ = environ.Env(
    DEBUG=(bool, False),
    DJANGO_ENV=(str, 'development'),
    EMAIL_SECURE=(bool, True),
    HOSTNAME=(str, 'greentogo'),
    G2G_URL=(str, 'http://localhost:3000'),
    EMAIL_FROM=(str, None),
)
environ.Env.read_env()  # reading .env file

SITE_ROOT = __root__()

# 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/1.10/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '1+rc*=eii(d_im=1%x(q4di-_)14=ksa6u70nzs_h61m(+1zda'
Ejemplo n.º 5
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import environ

root = environ.Path(__file__) - 3  # three folder back (/a/b/c/ - 3 = /)
base_dir = root.path('../')
env = environ.Env(DEBUG=(bool, False), )  # set default values and casting
environ.Env.read_env()  # reading .env file

PROJECT_ROOT = root()
BASE_DIR = base_dir()

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[])

DEBUG = True

SECRET_KEY = 'FAKEforDEV'

ROOT_URLCONF = 'seolondon.urls'

WSGI_APPLICATION = 'seolondon.wsgi.application'

LANGUAGE_CODE = 'en'

TIME_ZONE = 'Europe/London'

USE_I18N = False

USE_L10N = False
Ejemplo n.º 6
0
"""
Django settings for music project.

Generated by 'django-admin startproject' using Django 3.1.7.

For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import environ
environ.Env()
environ.Env.read_env()
import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ['SECRET_KEY']

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ['DEBUG']

ALLOWED_HOSTS = []
Ejemplo n.º 7
0
import os

import environ

__all__ = (
    "PROJECT_DIR",
    "BASE_DIR",
    "ENV",
)

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)

# Read configuration variables from .env file
ENV = environ.Env()
environ.Env.read_env(".env")
Ejemplo n.º 8
0
Django settings for config project.

Generated by 'django-admin startproject' using Django 2.2.17.

For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

import os
import environ
PROJECT_ROOT = environ.Path(__file__) - 2
env = environ.Env(
    # set casting, default value
    DEBUG=(bool, True),
    HEROKU=(bool, False))

SECRET_KEY = env("SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env("DEBUG")
HEROKU = env("HEROKU")
# 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/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
Ejemplo n.º 9
0
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 environ

root = environ.Path(
    __file__) - 3  # root is two parents up of directory containing base.py
BASE_DIR = root()
DOCKER_SENTINEL = object()
env = environ.Env(
    EDD_DEBUG=(bool, False),
    ICE_HMAC_KEY=(str, ''),
    LDAP_PASS=(str, None),
    SECRET_KEY=(str, DOCKER_SENTINEL),
)
# Use the SECRET_KEY to detect if env is setup via Docker; if not, load from file secrets.env
if env('SECRET_KEY', default=DOCKER_SENTINEL) is DOCKER_SENTINEL:
    # read passwords into the environment from secrets.env
    env.read_env(root('docker_services', 'secrets.env'))

###################################################################################################
# Custom EDD-defined configuration options
###################################################################################################

EDD_VERSION_NUMBER = env('EDD_VERSION', default='2.4.0')
EDD_VERSION_HASH = env('EDD_VERSION_HASH', default=None)

# Optionally alter the UI to make a clear distinction between deployment environments (e.g. to
Ejemplo n.º 10
0
import secrets
import sys
import typing

import environ
import sentry_sdk
from django.contrib.messages import constants as messages
from sentry_sdk.integrations.django import DjangoIntegration

from pydis_site.constants import GIT_SHA

if typing.TYPE_CHECKING:
    from django.contrib.auth.models import User
    from wiki.models import Article

env = environ.Env(DEBUG=(bool, False), SITE_DSN=(str, ""))

sentry_sdk.init(dsn=env('SITE_DSN'),
                integrations=[DjangoIntegration()],
                send_default_pii=True,
                release=f"site@{GIT_SHA}")

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = env('DEBUG')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
if DEBUG:
Ejemplo n.º 11
0
Django settings for talk_dev_to_me_backend project.

Generated by 'django-admin startproject' using Django 3.2.1.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""

from pathlib import Path
import os
import environ

env = environ.Env(DEBUG=(bool, False))

environ.Env.read_env()

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str("SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DEBUG")
Ejemplo n.º 12
0
env = environ.Env(
    # Set casting and default values
    DD_DEBUG=(bool, False),
    DD_LOGIN_REDIRECT_URL=(str, '/'),
    DD_DJANGO_ADMIN_ENABLED=(bool, False),
    DD_SESSION_COOKIE_HTTPONLY=(bool, True),
    DD_CSRF_COOKIE_HTTPONLY=(bool, True),
    DD_SECURE_SSL_REDIRECT=(bool, False),
    DD_SECURE_HSTS_INCLUDE_SUBDOMAINS=(bool, False),
    DD_SECURE_HSTS_SECONDS=(int, 31536000),  # One year expiration
    DD_CSRF_COOKIE_SECURE=(bool, False),
    DD_SECURE_BROWSER_XSS_FILTER=(bool, False),
    DD_TIME_ZONE=(str, 'UTC'),
    DD_LANG=(str, 'en-us'),
    DD_WKHTMLTOPDF=(str, '/usr/local/bin/wkhtmltopdf'),
    DD_TEAM_NAME=(str, 'Security Team'),
    DD_ADMINS=(str, 'DefectDojo:dojo@localhost,Admin:admin@localhost'),
    DD_PORT_SCAN_CONTACT_EMAIL=(str, 'email@localhost'),
    DD_PORT_SCAN_RESULT_EMAIL_FROM=(str, 'email@localhost'),
    DD_PORT_SCAN_EXTERNAL_UNIT_EMAIL_LIST=(str, ['email@localhost']),
    DD_PORT_SCAN_SOURCE_IP=(str, '127.0.0.1'),
    DD_WHITENOISE=(bool, False),
    DD_TRACK_MIGRATIONS=(bool, False),
    DD_SECURE_PROXY_SSL_HEADER=(bool, False),
    DD_TEST_RUNNER=(str, 'django.test.runner.DiscoverRunner'),
    DD_URL_PREFIX=(str, ''),
    DD_ROOT=(str, root('dojo')),
    DD_LANGUAGE_CODE=(str, 'en-us'),
    DD_SITE_ID=(int, 1),
    DD_USE_I18N=(bool, True),
    DD_USE_L10N=(bool, True),
    DD_USE_TZ=(bool, True),
    DD_MEDIA_URL=(str, '/media/'),
    DD_MEDIA_ROOT=(str, root('media')),
    DD_STATIC_URL=(str, '/static/'),
    DD_STATIC_ROOT=(str, root('static')),
    DD_CELERY_BROKER_URL=(str, ''),
    DD_CELERY_BROKER_SCHEME=(str, 'sqla+sqlite'),
    DD_CELERY_BROKER_USER=(str, ''),
    DD_CELERY_BROKER_PASSWORD=(str, ''),
    DD_CELERY_BROKER_HOST=(str, ''),
    DD_CELERY_BROKER_PORT=(int, -1),
    DD_CELERY_BROKER_PATH=(str, '/dojo.celerydb.sqlite'),
    DD_CELERY_TASK_IGNORE_RESULT=(bool, True),
    DD_CELERY_RESULT_BACKEND=(str, 'django-db'),
    DD_CELERY_RESULT_EXPIRES=(int, 86400),
    DD_CELERY_BEAT_SCHEDULE_FILENAME=(str, root('dojo.celery.beat.db')),
    DD_CELERY_TASK_SERIALIZER=(str, 'pickle'),
    DD_FORCE_LOWERCASE_TAGS=(bool, True),
    DD_MAX_TAG_LENGTH=(int, 25),
    DD_DATABASE_ENGINE=(str, 'django.db.backends.mysql'),
    DD_DATABASE_HOST=(str, 'mysql'),
    DD_DATABASE_NAME=(str, 'defectdojo'),
    DD_DATABASE_PASSWORD=(str, 'defectdojo'),
    DD_DATABASE_PORT=(int, 3306),
    DD_DATABASE_USER=(str, 'defectdojo'),
    DD_SECRET_KEY=(str, '.'),
    DD_CREDENTIAL_AES_256_KEY=(str, '.'),
)
Ejemplo n.º 13
0
env = environ.Env(
    ALLOWED_HOSTS=(list, []),
    ASSET_DOMAIN=(str, ''),
    AWS_LOCATION=(str, ''),
    # old SQS information (x4)
    AWS_SQS_ACCESS_KEY_ID=(str, None),
    AWS_SQS_SECRET_ACCESS_KEY=(str, None),
    AWS_SQS_REGION=(str, None),
    PETITION_SQS_QUEUE_URL=(str, None),
    # new SQS information (x4)
    CRM_AWS_SQS_ACCESS_KEY_ID=(str, None),
    CRM_AWS_SQS_SECRET_ACCESS_KEY=(str, None),
    CRM_AWS_SQS_REGION=(str, None),
    CRM_PETITION_SQS_QUEUE_URL=(str, None),
    CONTENT_TYPE_NO_SNIFF=bool,
    CORS_REGEX_WHITELIST=(tuple, ()),
    CORS_WHITELIST=(tuple, ()),
    DATABASE_URL=(str, None),
    DEBUG=(bool, False),
    DJANGO_LOG_LEVEL=(str, 'INFO'),
    DOMAIN_REDIRECT_MIDDLWARE_ENABLED=(bool, False),
    FILEBROWSER_DEBUG=(bool, False),
    FILEBROWSER_DIRECTORY=(str, ''),
    RANDOM_SEED=(int, None),
    HEROKU_APP_NAME=(str, ''),
    NETWORK_SITE_URL=(str, ''),
    PETITION_TEST_CAMPAIGN_ID=(str, ''),
    PULSE_API_DOMAIN=(str, ''),
    PULSE_DOMAIN=(str, ''),
    SET_HSTS=bool,
    SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=(str, None),
    SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=(str, None),
    SSL_REDIRECT=bool,
    DOMAIN_REDIRECT_MIDDLEWARE_ENABLED=(bool, False),
    MOZFEST_DOMAIN_REDIRECT_ENABLED=(bool, False),
    TARGET_DOMAINS=(list, []),
    USE_S3=(bool, True),
    USE_X_FORWARDED_HOST=(bool, False),
    XSS_PROTECTION=bool,
    REFERRER_HEADER_VALUE=(str, ''),
    GITHUB_TOKEN=(str, ''),
    SLACK_WEBHOOK_RA=(str, ''),
    BUYERS_GUIDE_VOTE_RATE_LIMIT=(str, '200/hour'),
    CORAL_TALK_SERVER_URL=(str, None),
    PNI_STATS_DB_URL=(str, None),
    CORAL_TALK_API_TOKEN=(str, None),
    REDIS_URL=(str, ''),
    USE_CLOUDINARY=(bool, False),
    CLOUDINARY_CLOUD_NAME=(str, ''),
    CLOUDINARY_API_KEY=(str, ''),
    CLOUDINARY_API_SECRET=(str, ''),
)
Ejemplo n.º 14
0
"""Common settings and globals."""
import os
from os.path import abspath, basename, dirname, join, normpath
from sys import path
from datetime import datetime
import environ

root = environ.Path(__file__) - 4  # (/open_bilanci/bilanci_project/bilanci/settings/ - 4 = /)

# set default values and casting
env = environ.Env(
    DEBUG=(bool, True),
)
env.read_env(root('.env'))

########## INSTANCE TYPE: production | staging | development | test
INSTANCE_TYPE = env.str('INSTANCE_TYPE')

########## PATH CONFIGURATION
REPO_ROOT = root()
PROJECT_ROOT = root('bilanci_project')

# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_ROOT)

# Site name:
SITE_ROOT = root('bilanci_project/bilanci')
SITE_NAME = basename(SITE_ROOT)
SITE_VERSION = 'beta'
########## END PATH CONFIGURATION