STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"

SASS_PROCESSOR_ENABLED = True

# File Upload
# https://github.com/uktrade/s3chunkuploader
S3_DOCUMENT_ROOT_DIRECTORY = ""
S3_APPEND_DATETIME_ON_UPLOAD = True
S3_PREFIX_QUERY_PARAM_NAME = ""
S3_DOWNLOAD_LINK_EXPIRY_SECONDS = 180
STREAMING_CHUNK_SIZE = 8192
S3_MIN_PART_SIZE = 5 * 1024 * 1024
MAX_UPLOAD_SIZE = 50 * 1024 * 1024

# AWS
VCAP_SERVICES = env.json("VCAP_SERVICES", {})

if VCAP_SERVICES:
    if "aws-s3-bucket" not in VCAP_SERVICES:
        raise Exception("S3 Bucket not bound to environment")

    aws_credentials = VCAP_SERVICES["aws-s3-bucket"][0]["credentials"]
    AWS_ACCESS_KEY_ID = aws_credentials["aws_access_key_id"]
    AWS_SECRET_ACCESS_KEY = aws_credentials["aws_secret_access_key"]
    AWS_REGION = aws_credentials["aws_region"]
    AWS_STORAGE_BUCKET_NAME = aws_credentials["bucket_name"]
else:
    AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID")
    AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY")
    AWS_REGION = env("AWS_REGION")
    AWS_STORAGE_BUCKET_NAME = env("AWS_STORAGE_BUCKET_NAME")
from sentry_sdk.integrations.django import DjangoIntegration

ROOT_DIR = Path(__file__).parents[2]

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

ENV_FILE = os.path.join(BASE_DIR, ".env")

if os.path.exists(ENV_FILE):
    Env.read_env(ENV_FILE)

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

# Load PaaS Service env vars
VCAP_SERVICES = env.json("VCAP_SERVICES", default={})

# 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")

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

ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=[])
# Application definition

ELASTIC_APM_ENABLED = env("ELASTIC_APM_ENABLED", default=not DEBUG)
Exemple #3
0
ROOT_DIR = Path(__file__).parents[2]

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

ENV_FILE = os.path.join(BASE_DIR, ".env")

if os.path.exists(ENV_FILE):
    Env.read_env(ENV_FILE)

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

# Load PaaS Service env vars
VCAP_SERVICES = env.json('VCAP_SERVICES', default={})

# 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")

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

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

ELASTIC_APM_ENABLED = env("ELASTIC_APM_ENABLED", default=not DEBUG)
Exemple #4
0
ELECTION_CODE = env('ELECTION_CODE', default='election')
ELECTION_NAME = env('ELECTION_NAME', default='Elezioni')
PARTY_LEADER = env('PARTY_LEADER', default='Segretario')
PARTY_COALITION = env('PARTY_COALITION', default='Coalizione')

PARTY_TERM = env('PARTY_TERM', default='Partito')
PARTY_TERM_PLURAL = env('PARTY_TERM_PLURAL', default='Partiti')
PARTY_TERM_GENDER = env('PARTY_TERM_GENDER', default='male')
OF_PARTY_TERM_PLURAL = env('OF_PARTY_TERM_PLURAL', default='dei partiti')
THE_PARTY_TERM_PLURAL = env('THE_PARTY_TERM_PLURAL', default='i partiti')

PARTY_DESCRIPTION_TERM = env('PARTY_DESCRIPTION_TERM', default='Descrizione')
PARTY_LINKED_PARTIES_TERM = env('PARTY_LINKED_PARTIES_TERM', default='Partiti collegati')

OTHER_ELECTIONS = env.json('OTHER_ELECTIONS', default=[])
SHOW_PARTY_COALITION = env.bool('SHOW_PARTY_COALITION', default=True)

# External service configurations
HASHTAG = env('HASHTAG', default='voisietequi')
OP_BLOG_CATEGORY = env('OP_BLOG_CATEGORY', default='piattaforme/voisietequi')
DISQUS_FORUM = env('DISQUS_FORUM', default='')

# Computer configuration
COMPUTER_URL = env('COMPUTER_URL', default='http://urlcomputer.dominio.it')
PUB_ADDR = env('PUB_ADDR', default='*:5556')
PULL_ADDR = env('PULL_ADDR', default='*:5557')

# Mailbin configuration
MAILBIN_URL = env('MAILBIN_URL', default='tcp://127.0.0.1:5558')
MAILBIN_SERVICE = env('MAILBIN_SERVICE', default='xxx.voisietequi.it')