Set DEBUG=True with dotenv

This commit is contained in:
Andrey Golovizin 2020-03-10 20:56:25 +01:00
parent ef3cab912e
commit b522b7470f
5 changed files with 27 additions and 4 deletions

1
.env Normal file
View file

@ -0,0 +1 @@
STROJNADZOR_DEBUG=1

View file

@ -988,6 +988,23 @@ let
};
};
"python-dotenv" = python.mkDerivation {
name = "python-dotenv-0.12.0";
src = pkgs.fetchurl {
url = "https://files.pythonhosted.org/packages/81/8b/26f807fa58582455f8ebb07f1b7473ee1a21b4671d1eaf4fecece9337e2a/python-dotenv-0.12.0.tar.gz";
sha256 = "92b3123fb2d58a284f76cc92bfe4ee6c502c32ded73e8b051c4f6afc8b6751ed";
};
doCheck = commonDoCheck;
format = "pyproject";
buildInputs = commonBuildInputs ++ [ ];
propagatedBuildInputs = [ ];
meta = with pkgs.stdenv.lib; {
homepage = "http://github.com/theskumar/python-dotenv";
license = licenses.bsdOriginal;
description = "Add .env support to your django/flask apps in development and deployments";
};
};
"pytz" = python.mkDerivation {
name = "pytz-2019.3";
src = pkgs.fetchurl {

View file

@ -21,3 +21,4 @@ django-sekizai>=1.0
django-mptt>0.9
gunicorn
python-dotenv

View file

@ -44,6 +44,7 @@ lxml==4.5.0
openpyxl==2.4.9
Pillow==7.0.0
premailer==3.6.1
python-dotenv==0.12.0
pytz==2019.3
requests==2.23.0
setuptools-scm==3.5.0

View file

@ -11,6 +11,9 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os # isort:skip
import dotenv
dotenv.load_dotenv()
gettext = lambda s: s
@ -36,9 +39,9 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
SECRET_KEY = "15-d*6bl(@+jfo92@=67vi1ohx%3e&^l98*bo*v$$+ms%!l(!!"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = bool(os.getenv("STROJNADZOR_DEBUG"))
ALLOWED_HOSTS = ['.golovizin.ru', '.xn--b1abndboscb.xn--p1ai', 'localhost']
ALLOWED_HOSTS = [".golovizin.ru", ".xn--b1abndboscb.xn--p1ai", "localhost"]
# Application definition
@ -226,9 +229,9 @@ DJANGOCMS_PICTURE_RESPONSIVE_IMAGES_VIEWPORT_BREAKPOINTS = [300, 400, 576, 768]
DEFAULT_FROM_EMAIL = "noreply@sologoc.com"
CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_arcs',)
CAPTCHA_NOISE_FUNCTIONS = ("captcha.helpers.noise_arcs",)
CAPTCHA_FILTER_FUNCTIONS = ()
CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.word_challenge'
CAPTCHA_CHALLENGE_FUNCT = "captcha.helpers.word_challenge"
CAPTCHA_FONT_PATH = os.path.join(BASE_DIR, "DejaVuSans.ttf")
CAPTCHA_WORDS_DICTIONARY = os.path.join(BASE_DIR, "construction.txt")
CAPTCHA_LENGTH = 5