Пример #1
0
def version():
    commit_hash = None
    head_file_path = '.git/HEAD'

    while head_file_path is not None:
        head_file = Path(root(head_file_path))

        if not (head_file.exists() and head_file.is_file()):
            break

        with head_file.open() as f:
            commit_hash = f.readline().replace('\n', '')

        if not commit_hash.startswith('ref: '):
            head_file_path = None
            continue

        head_file_path = f'.git/{commit_hash[5:]}'

    return commit_hash
Пример #2
0
from config.settings import root, env

# Build paths inside the project like this: root(...)
BASE_DIR = root()

# 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!
SECRET_KEY = env('SECRET_KEY')

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

ROOT_URLCONF = 'config.urls'

WSGI_APPLICATION = 'config.wsgi.application'

CORS_ORIGIN_WHITELIST = env.list('CORS_ORIGINS', default=[])

SHOW_DOCS = env('SHOW_DOCS', default=False)

VOTE_ADMIN = env('VOTE_ADMIN', default=False)
Пример #3
0
from config.settings import root

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            root('template'),
        ],
        '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',
            ],
        },
    },
]
Пример #4
0
from config.settings import root

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

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    root('static'),
]

STATIC_ROOT = root('assets')

MEDIA_URL = '/media/'

MEDIA_ROOT = root('media')
Пример #5
0
from config.settings import root


TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            root('templates'),
        ],
        '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',
            ],
        },
    },
]
Пример #6
0
from config.settings import env, root

# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
    'default': env.db_url(),
}

FIXTURE_DIRS = [
    root('db', 'fixture'),
]