Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- from django.core.exceptions import ImproperlyConfigured
- from unipath import Path
- BASE_DIR = Path(__file__).ancestor(3)
- with open("global_data.json") as f:
- value = json.loads(f.read())
- def get_value(value_title, values=value):
- try:
- return values[value_title]
- except:
- msg = f"The name of {value_title} doesn't exists"
- raise ImproperlyConfigured(msg)
- def gettext(s):
- return s
- SECRET_KEY = get_value('SECRET_KEY')
- LANGUAGE_CODE = get_value('LANGUAGE_CODE')
- TIME_ZONE = get_value('TIME_ZONE')
- DJANGO_APPS = (
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- )
- THIRD_PARTY_APPS = (
- #
- )
- LOCAL_APPS = (
- #
- )
- INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
- WSGI_APPLICATION = f'{get_value("CORE_APP")}.wsgi.application'
- ROOT_URLCONF = f'{get_value("CORE_APP")}.urls'
- DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
- MIDDLEWARE = [
- 'django.middleware.security.SecurityMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.middleware.common.CommonMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
- 'django.middleware.locale.LocaleMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
- 'django.middleware.clickjacking.XFrameOptionsMiddleware',
- ]
- TEMPLATES = [
- {
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [BASE_DIR.child('templates')],
- 'APP_DIRS': True,
- 'OPTIONS': {
- 'context_processors': [
- 'django.contrib.auth.context_processors.auth',
- 'django.contrib.messages.context_processors.messages',
- 'django.template.context_processors.debug',
- 'django.template.context_processors.request',
- 'django.template.context_processors.i18n',
- 'django.template.context_processors.csrf',
- 'django.template.context_processors.media',
- ],
- },
- },
- ]
- AUTH_PASSWORD_VALIDATORS = [
- {
- 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
- },
- ]
- TIME_ZONE = 'America/Bogota'
- DEFAULT_CHARSET = 'utf-8'
- LANGUAGES = (
- ('es-co', gettext('Español Colombia')),
- ('en', gettext('English')),
- )
- LOCALE_PATHS = [
- BASE_DIR.child('locale'),
- ]
- USE_I18N = True
- USE_L10N = True
- USE_TZ = True
- STATIC_URL = '/static/'
- MEDIA_URL = '/media/'
- MEDIA_ROOT = BASE_DIR.child('media')
- STATICFILES_DIRS = [BASE_DIR.child('static')]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement