Last active
June 7, 2019 04:48
-
-
Save ilya-muhortov/2baff95f278423f269d28cdc56e59e50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import environ | |
import datetime | |
import django as django_module | |
from django.conf.locale.ru import formats as ru_formats | |
ru_formats.DATE_FORMAT = 'd.m.Y' | |
ru_formats.DATETIME_FORMAT = 'd.m.Y G:i' | |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
DJANGO_DIR = os.path.dirname(django_module.__file__) | |
root = environ.Path(__file__) - 2 | |
env = environ.Env( | |
DEBUG=(bool, False), | |
) | |
environ.Env.read_env('.env') | |
DEBUG = env('DEBUG', False) | |
ALLOWED_HOSTS = ['*'] | |
TEMPLATES[0]['DIRS'] = [ | |
os.path.join(BASE_DIR, 'app/templates'), | |
DJANGO_DIR | |
] | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql', | |
'NAME': env.str('POSTGRES_DB'), | |
'USER': env.str('POSTGRES_USER'), | |
'PASSWORD': env.str('POSTGRES_PASSWORD'), | |
'HOST': 'postgres-host', | |
'PORT': '5432' | |
} | |
} | |
STATIC_URL = '/static/' | |
MEDIA_URL = '/media/' | |
STATIC_ROOT = os.path.join(BASE_DIR, 'public/static') | |
MEDIA_ROOT = os.path.join(BASE_DIR, 'public/media') | |
if DEBUG is False: | |
import sentry_sdk | |
from sentry_sdk.integrations.django import DjangoIntegration | |
sentry_sdk.init( | |
dsn="", | |
integrations=[DjangoIntegration()] | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import path, include | |
from django.conf import settings | |
if settings.DEBUG: | |
from django.conf.urls.static import static | |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
urlpatterns += staticfiles_urlpatterns() | |
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment