Example #1
0
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/

LANGUAGE_CODE = 'pt-br'

TIME_ZONE = 'America/Sao_Paulo'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

LOGIN_REDIRECT_URL = "home"
LOGOUT_REDIRECT_URL = "login"

TOKEN_PAGAR_ME = env.get_value('TOKEN_PAGAR_ME', default="ak_test_cIOWRhulKZKqjMq32rL0umvtdAjN49"),
Example #2
0
import os
from environ import Env

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

# Environment variables
env = Env()
env.read_env(os.path.join(BASE_DIR, '.env'))

# 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.get_value('SECRET_KEY', default='default-secret-key')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
Example #3
0
#!/usr/bin/env python3.7

# Requirement:
# django-environ==0.4.5

import os

from environ import Env

env = Env()

# 通过环境变量获取到配置文件名
env_file = f'env.{env.str("PROJECT_ENV")}'

# 通过环境变量获取配置路径,并加载配置
if 'CONFIG_PATH' in env:
    env_file_path = os.path.join(env.get_value('CONFIG_PATH'), env_file)
    assert os.path.exists(env_file_path), f'{env_file_path} do not exists'
    env.read_env(env_file_path)
else:
    env_file_path = env_file
    env.read_env(env_file_path)

if __name__ == '__main__':
    print(env.str('agent_user'))
    print(env.str('corp_user'))
Example #4
0
USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'

# AUTH
AUTH_USER_MODEL = 'accounts.User'

# Channels
ASGI_APPLICATION = 'chatApp.asgi.application'

# Channels Redis
CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels_redis.core.RedisChannelLayer',
        'CONFIG': {
            'hosts': [(env.get_value('DJ_REDIS_HOST', default='redis'), 6379)],
        },
    },
}

# Celery config
CELERY_BROKER_URL = env('DJ_RABBITMQ_BROKER')
CELERY_TASK_ALWAYS_EAGER = env('DJ_RABBITMQ_DEBUG')
CELERY_WORKER_CONCURRENCY = 5