예제 #1
0
    def test_root_logger_config(self):
        """
        Assert basic expectations about the root logger.

        Due to a misreading of
        https://docs.python.org/2/library/logging.config.html#dictionary-schema-details,
        d12f was at one point configuring a logger named "root", rather than
        the actual root logger. This was obviously mildly suboptimal.

        This test makes more assumptions than ideal about how the desired root
        config.
        """
        with debug_env:
            logging.config.dictConfig(django12factor.factorise()['LOGGING'])
            self.assertTrue(has_handler(logging.root, "stdout"))
예제 #2
0
    def test_root_logger_config(self):
        """
        Assert basic expectations about the root logger.

        Due to a misreading of
        https://docs.python.org/2/library/logging.config.html#dictionary-schema-details,
        d12f was at one point configuring a logger named "root", rather than
        the actual root logger. This was obviously mildly suboptimal.

        This test makes more assumptions than ideal about how the desired root
        config.
        """
        with debug_env:
            logging.config.dictConfig(django12factor.factorise()['LOGGING'])
            self.assertTrue(has_handler(logging.root, "stdout"))
예제 #3
0
Django settings for poll_service project.

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

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 django12factor

d12f = django12factor.factorise()


# 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 = d12f['SECRET_KEY']

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = d12f['DEBUG']
예제 #4
0
TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')


# django12factor
# https://django12factor.readthedocs.org/

import django12factor
_custom_settings = [
]
d12f = django12factor.factorise(custom_settings=_custom_settings)

ALLOWED_HOSTS = d12f.get('ALLOWED_HOSTS')
DATABASES = d12f.get('DATABASES')
DEBUG = d12f.get('DEBUG')
LOGGING = d12f.get('LOGGING')
SECRET_KEY = d12f.get('SECRET_KEY')
예제 #5
0
TIME_ZONE = "UTC"

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = "/static/"


globals().update(django12factor.factorise())


if "SECRET_KEY" not in globals():
    import random

    SECRET_KEY = "".join(
        [
            random.SystemRandom().choice(
                "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)"
            )
            for i in range(50)
        ]
    )
from .base import *

DEBUG = True
TEMPLATE_DEBUG = DEBUG

from django12factor import factorise
globals().update(factorise())
예제 #7
0
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, '../static'),
)

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, '../templates'),
)

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP

TEMPLATE_CONTEXT_PROCESSORS = TCP + (
    'django.core.context_processors.request',
    "allauth.account.context_processors.account",
    "allauth.socialaccount.context_processors.socialaccount",)

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',
)

import django12factor
globals().update(django12factor.factorise())

TEMPLATE_DEBUG = DEBUG

APPEND_SLASH=False
예제 #8
0
#!/usr/bin/env python
from __future__ import absolute_import
import os
from django.conf import settings
import django12factor
from django.http import HttpResponse
from celery import Celery


# Configuration
BASE_DIR = os.path.dirname(__file__)
d12f = django12factor.factorise()
if not settings.configured:
    settings.configure(
        DEBUG=d12f['DEBUG'],
        TEMPLATE_DEBUG=d12f['TEMPLATE_DEBUG'],
        SECRET_KEY=d12f.get('SECRET_KEY', os.urandom(32)),
        ROOT_URLCONF=__name__,
        MIDDLEWARE_CLASSES=(
            'django.middleware.common.CommonMiddleware',
            #'django.middleware.csrf.CsrfViewMiddleware',
            'django.middleware.clickjacking.XFrameOptionsMiddleware',
        ),
        TEMPLATE_DIRS=(
            os.path.join(BASE_DIR, 'templates'),
        ),
        LOGGING=d12f['LOGGING'],
        DATABASES=d12f['DATABASES'],
        INSTALLED_APPS=(
            'rdflib_django',
            'kombu.transport.django',