summaryrefslogtreecommitdiff
path: root/talerbank/settings.py
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-28 21:36:51 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-28 21:36:51 +0200
commit4e569d7584c6a128ab685fc9ca0539139df8bca4 (patch)
treebe604a5580f8a6096827fa02240ca466674c8777 /talerbank/settings.py
parentd95ade12b327e36994d628722be05c4b101c2eae (diff)
downloadbank-4e569d7584c6a128ab685fc9ca0539139df8bca4.tar.gz
bank-4e569d7584c6a128ab685fc9ca0539139df8bca4.tar.bz2
bank-4e569d7584c6a128ab685fc9ca0539139df8bca4.zip
format code with yapf
Diffstat (limited to 'talerbank/settings.py')
-rw-r--r--talerbank/settings.py75
1 files changed, 35 insertions, 40 deletions
diff --git a/talerbank/settings.py b/talerbank/settings.py
index 97a18dd..ff67f80 100644
--- a/talerbank/settings.py
+++ b/talerbank/settings.py
@@ -25,19 +25,19 @@ TC = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE"))
# Build paths inside the project like this:
# os.path.join(BASE_DIR, ...)
-BASE_DIR = os.path.dirname(
- os.path.dirname(os.path.abspath(__file__)))
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
-
SECRET_KEY = os.environ.get("TALER_BANK_SECRET_KEY", None)
if not SECRET_KEY:
- LOGGER.info("secret key not configured in"
- " TALER_BANK_SECRET_KEY env variable,"
- " generating random secret")
+ LOGGER.info(
+ "secret key not configured in"
+ " TALER_BANK_SECRET_KEY env variable,"
+ " generating random secret"
+ )
SECRET_KEY = base64.b64encode(os.urandom(32)).decode('utf-8')
# SECURITY WARNING: don't run with debug turned on in production!
@@ -55,16 +55,12 @@ LOGIN_URL = "login"
LOGIN_REDIRECT_URL = "index"
-
# Application definition
INSTALLED_APPS = [
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'talerbank.app'
+ 'django.contrib.auth', 'django.contrib.contenttypes',
+ 'django.contrib.sessions', 'django.contrib.messages',
+ 'django.contrib.staticfiles', 'talerbank.app'
]
MIDDLEWARE = [
@@ -80,14 +76,17 @@ MIDDLEWARE = [
'talerbank.app.middleware.DecompressionMiddleware'
]
-TEMPLATES = [
- {'BACKEND': 'django.template.backends.jinja2.Jinja2',
- 'DIRS': [os.path.join(BASE_DIR,
- "talerbank/app/static/web-common/"),
- os.path.join(BASE_DIR,
- "talerbank/app/templates")],
- 'OPTIONS': {
- 'environment': 'talerbank.jinja2.environment'}}]
+TEMPLATES = [{
+ 'BACKEND':
+ 'django.template.backends.jinja2.Jinja2',
+ 'DIRS': [
+ os.path.join(BASE_DIR, "talerbank/app/static/web-common/"),
+ os.path.join(BASE_DIR, "talerbank/app/templates")
+ ],
+ 'OPTIONS': {
+ 'environment': 'talerbank.jinja2.environment'
+ }
+}]
# Disable those, since they don't work with
# jinja2 anyways.
@@ -95,7 +94,6 @@ TEMPLATE_CONTEXT_PROCESSORS = []
WSGI_APPLICATION = 'talerbank.wsgi.application'
-
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
@@ -111,7 +109,8 @@ if not DBNAME:
LOGGER.info("dbname: %s" % DBNAME)
CHECK_DBSTRING_FORMAT = re.search(
- r"[a-z]+:///[a-z]+([\?][a-z]+=[a-z/]+)?", DBNAME)
+ r"[a-z]+:///[a-z]+([\?][a-z]+=[a-z/]+)?", DBNAME
+)
if not CHECK_DBSTRING_FORMAT:
LOGGER.error("Bad db string given '%s', respect the format" \
"'dbtype:///dbname'" % DBNAME)
@@ -138,7 +137,7 @@ else:
HOST = DB_URL.netloc
if HOST:
- DBCONFIG["HOST"] = HOST # Sockets directory.
+ DBCONFIG["HOST"] = HOST # Sockets directory.
DATABASES["default"] = DBCONFIG
@@ -155,7 +154,6 @@ AUTH_PASSWORD_VALIDATORS = [
{'NAME': 'django.contrib.auth.password_validation' \
'.NumericPasswordValidator'}]
-
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
@@ -186,28 +184,25 @@ STATIC_ROOT = None
ROOT_URLCONF = "talerbank.urls"
try:
- TALER_CURRENCY = TC.value_string(
- "taler", "currency", required=True)
+ TALER_CURRENCY = TC.value_string("taler", "currency", required=True)
except ConfigurationError as exc:
LOGGER.error(exc)
sys.exit(3)
TALER_MAX_DEBT = TC.value_string(
- "bank", "MAX_DEBT",
- default="%s:50.0" % TALER_CURRENCY)
+ "bank", "MAX_DEBT", default="%s:50.0" % TALER_CURRENCY
+)
TALER_MAX_DEBT_BANK = TC.value_string(
- "bank", "MAX_DEBT_BANK",
- default="%s:0.0" % TALER_CURRENCY)
+ "bank", "MAX_DEBT_BANK", default="%s:0.0" % TALER_CURRENCY
+)
-TALER_DIGITS = TC.value_int(
- "bank", "NDIGITS", default=2)
+TALER_DIGITS = TC.value_int("bank", "NDIGITS", default=2)
# Order matters
TALER_PREDEFINED_ACCOUNTS = [
- 'Bank', 'Exchange', 'Tor', 'GNUnet',
- 'Taler', 'FSF', 'Tutorial', 'Survey']
-TALER_EXPECTS_DONATIONS = [
- 'Tor', 'GNUnet', 'Taler', 'FSF']
-TALER_SUGGESTED_EXCHANGE = TC.value_string(
- "bank", "suggested_exchange")
+ 'Bank', 'Exchange', 'Tor', 'GNUnet', 'Taler', 'FSF', 'Tutorial', 'Survey'
+]
+TALER_EXPECTS_DONATIONS = ['Tor', 'GNUnet', 'Taler', 'FSF']
+TALER_SUGGESTED_EXCHANGE = TC.value_string("bank", "suggested_exchange")
TALER_SUGGESTED_EXCHANGE_PAYTO = TC.value_string(
- "bank", "suggested_exchange_payto")
+ "bank", "suggested_exchange_payto"
+)