gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-bank] 01/05: towards removing the 'admin' interface


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] 01/05: towards removing the 'admin' interface
Date: Wed, 10 May 2017 16:22:04 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository bank.

commit c23a650cee3327f693040555956f01d9da886929
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed May 10 12:08:17 2017 +0200

    towards removing the 'admin' interface
---
 talerbank/app/urls.py       |   1 +
 talerbank/app/urlsadmin.py  |  23 ------
 talerbank/settings.py       | 191 +++++++++++++++++++++++++++++++++++++++++++-
 talerbank/settings_admin.py |   2 -
 talerbank/settings_base.py  | 191 --------------------------------------------
 5 files changed, 191 insertions(+), 217 deletions(-)

diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index 85aec1c..667366c 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -22,6 +22,7 @@ urlpatterns = [
     url(r'^', include('talerbank.urls')),
     url(r'^$', RedirectView.as_view(pattern_name="profile"), name="index"),
     url(r'^favicon\.ico$', views.ignore),
+    url(r'^admin/add/incoming$', views.add_incoming, name="add-incoming"),
     url(r'^javascript(?:.html)?/$', views.javascript_licensing, 
name="javascript"),
     url(r'^login/$', views.login_view, name="login"),
     url(r'^logout/$', views.logout_view, name="logout"),
diff --git a/talerbank/app/urlsadmin.py b/talerbank/app/urlsadmin.py
deleted file mode 100644
index e2e51f8..0000000
--- a/talerbank/app/urlsadmin.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#  This file is part of TALER
-#  (C) 2014, 2015, 2016 INRIA
-#
-#  TALER is free software; you can redistribute it and/or modify it under the
-#  terms of the GNU Affero General Public License as published by the Free 
Software
-#  Foundation; either version 3, or (at your option) any later version.
-#
-#  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
-#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
-#  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License along with
-#  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
-#
-#  @author Marcello Stanisci
-
-from django.conf.urls import include, url
-from . import views
-
-urlpatterns = [
-    url(r'^', include('talerbank.urls')),
-    url(r'^admin/add/incoming$', views.add_incoming, name="add-incoming"),
-    ]
diff --git a/talerbank/settings.py b/talerbank/settings.py
index 6542acf..d5e7b63 100644
--- a/talerbank/settings.py
+++ b/talerbank/settings.py
@@ -1,2 +1,191 @@
-from talerbank.settings_base import *
+"""
+Django settings for talerbank.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.9/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.9/ref/settings/
+"""
+
+import os
+import logging
+import base64
+from .talerconfig import TalerConfig
+import sys
+import urllib.parse
+
+logger = logging.getLogger(__name__)
+
+logger.info("DJANGO_SETTINGS_MODULE: %s" % 
os.environ.get("DJANGO_SETTINGS_MODULE"))
+
+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__)))
+
+# 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:
+    logging.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!
+DEBUG = True
+
+ALLOWED_HOSTS = ["*"]
+
+LOGIN_URL = "login"
+
+LOGIN_REDIRECT_URL = "index"
+
+
+# Application definition
+
+INSTALLED_APPS = [
+    'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+    'talerbank.app'
+]
+
+MIDDLEWARE_CLASSES = [
+    'django.middleware.security.SecurityMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.common.CommonMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+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.
+TEMPLATE_CONTEXT_PROCESSORS = []
+
+WSGI_APPLICATION = 'talerbank.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
+
+DATABASES = {}
+
+# parse a database URL, django can't natively do this!
+dbname = tc.value_string("bank", "database", required=True)
+
+if not dbname:
+    raise Exception("'database' option value is missing from config")
+
+logger.info("dbname: %s" % dbname)
+dbconfig = {}
+db_url = urllib.parse.urlparse(dbname)
+
+if db_url.scheme not in ("postgres"):
+    raise Exception("DB '%s' is not supported" % db_url.scheme)
+
+if db_url.scheme == "postgres":
+    dbconfig["ENGINE"] = 'django.db.backends.postgresql_psycopg2'
+    dbconfig["NAME"] = db_url.path.lstrip("/")
+
+if not db_url.netloc:
+    p = urllib.parse.parse_qs(db_url.query)
+    if ("host" not in p) or len(p["host"]) == 0:
+        host = None
+    else:
+        host = p["host"][0]
+else:
+    host = db_url.netloc
+
+if host:
+    dbconfig["HOST"] = host
+
+logger.info("db string '%s'", dbname)
+logger.info("db info '%s'", dbconfig)
+
+DATABASES["default"] = dbconfig
+
+# Password validation
+# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
+
+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',
+    },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/1.9/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.9/howto/static-files/
+
+STATIC_URL = '/static/'
+
+STATICFILES_DIRS = [
+    os.path.join(BASE_DIR, "talerbank/app/static"),
+]
+
+# Currently we don't use "collectstatic", so this value isn't used.
+# Instead, we serve static files directly from the installed python package
+# via the "django.contrib.staticfiles" app.
+# We must set it to something valid though, # or django will give us warnings.
+STATIC_ROOT = '/tmp/talerbankstatic/'
+
 ROOT_URLCONF = "talerbank.app.urls"
+
+TALER_CURRENCY = tc.value_string("taler", "currency", required=True)
+
+TALER_MAX_DEBT = tc.value_string("bank", "MAX_DEBT",
+                                 default="50 {}".format(TALER_CURRENCY),
+                                 required=True)
+
+TALER_MAX_DEBT_BANK = tc.value_string("bank", "MAX_DEBT_BANK",
+                                      default="0 {}".format(TALER_CURRENCY),
+                                      required=True)
+TALER_DIGITS = 2
+TALER_PREDEFINED_ACCOUNTS = ['Tor', 'GNUnet', 'Taler', 'FSF', 'Tutorial']
+TALER_EXPECTS_DONATIONS = ['Tor', 'GNUnet', 'Taler', 'FSF']
+TALER_SUGGESTED_EXCHANGE = tc.value_string("bank", "suggested_exchange")
+
+logging.info("currency: '%s'", TALER_CURRENCY)
diff --git a/talerbank/settings_admin.py b/talerbank/settings_admin.py
deleted file mode 100644
index b2ce6a3..0000000
--- a/talerbank/settings_admin.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from talerbank.settings_base import *
-ROOT_URLCONF = "talerbank.app.urlsadmin"
diff --git a/talerbank/settings_base.py b/talerbank/settings_base.py
deleted file mode 100644
index 4371861..0000000
--- a/talerbank/settings_base.py
+++ /dev/null
@@ -1,191 +0,0 @@
-"""
-Django settings for talerbank.
-
-For more information on this file, see
-https://docs.djangoproject.com/en/1.9/topics/settings/
-
-For the full list of settings and their values, see
-https://docs.djangoproject.com/en/1.9/ref/settings/
-"""
-
-import os
-import logging
-import base64
-from .talerconfig import TalerConfig
-import sys
-import urllib.parse
-
-logger = logging.getLogger(__name__)
-
-logger.info("DJANGO_SETTINGS_MODULE: %s" % 
os.environ.get("DJANGO_SETTINGS_MODULE"))
-
-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__)))
-
-# 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:
-    logging.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!
-DEBUG = True
-
-ALLOWED_HOSTS = ["*"]
-
-LOGIN_URL = "login"
-
-LOGIN_REDIRECT_URL = "index"
-
-
-# Application definition
-
-INSTALLED_APPS = [
-    'django.contrib.admin',
-    'django.contrib.auth',
-    'django.contrib.contenttypes',
-    'django.contrib.sessions',
-    'django.contrib.messages',
-    'django.contrib.staticfiles',
-    'talerbank.app'
-]
-
-MIDDLEWARE_CLASSES = [
-    'django.middleware.security.SecurityMiddleware',
-    'django.contrib.sessions.middleware.SessionMiddleware',
-    'django.middleware.common.CommonMiddleware',
-    'django.middleware.csrf.CsrfViewMiddleware',
-    'django.contrib.auth.middleware.AuthenticationMiddleware',
-    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
-    'django.contrib.messages.middleware.MessageMiddleware',
-    'django.middleware.clickjacking.XFrameOptionsMiddleware',
-]
-
-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.
-TEMPLATE_CONTEXT_PROCESSORS = []
-
-WSGI_APPLICATION = 'talerbank.wsgi.application'
-
-
-# Database
-# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
-
-DATABASES = {}
-
-# parse a database URL, django can't natively do this!
-dbname = tc.value_string("bank", "database", required=True)
-
-if not dbname:
-    raise Exception("'database' option value is missing from config")
-
-logger.info("dbname: %s" % dbname)
-dbconfig = {}
-db_url = urllib.parse.urlparse(dbname)
-
-if db_url.scheme not in ("postgres"):
-    raise Exception("DB '%s' is not supported" % db_url.scheme)
-
-if db_url.scheme == "postgres":
-    dbconfig["ENGINE"] = 'django.db.backends.postgresql_psycopg2'
-    dbconfig["NAME"] = db_url.path.lstrip("/")
-
-if not db_url.netloc:
-    p = urllib.parse.parse_qs(db_url.query)
-    if ("host" not in p) or len(p["host"]) == 0:
-        host = None
-    else:
-        host = p["host"][0]
-else:
-    host = db_url.netloc
-
-if host:
-    dbconfig["HOST"] = host
-
-logger.info("db string '%s'", dbname)
-logger.info("db info '%s'", dbconfig)
-
-DATABASES["default"] = dbconfig
-
-# Password validation
-# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
-
-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',
-    },
-]
-
-
-# Internationalization
-# https://docs.djangoproject.com/en/1.9/topics/i18n/
-
-LANGUAGE_CODE = 'en-us'
-
-TIME_ZONE = 'UTC'
-
-USE_I18N = True
-
-USE_L10N = True
-
-USE_TZ = True
-
-
-# Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/1.9/howto/static-files/
-
-STATIC_URL = '/static/'
-
-STATICFILES_DIRS = [
-    os.path.join(BASE_DIR, "talerbank/app/static"),
-]
-
-# Currently we don't use "collectstatic", so this value isn't used.
-# Instead, we serve static files directly from the installed python package
-# via the "django.contrib.staticfiles" app.
-# We must set it to something valid though, # or django will give us warnings.
-STATIC_ROOT = '/tmp/talerbankstatic/'
-
-
-
-TALER_CURRENCY = tc.value_string("taler", "currency", required=True)
-
-TALER_MAX_DEBT = tc.value_string("bank", "MAX_DEBT",
-                                 default="50 {}".format(TALER_CURRENCY),
-                                 required=True)
-
-TALER_MAX_DEBT_BANK = tc.value_string("bank", "MAX_DEBT_BANK",
-                                      default="0 {}".format(TALER_CURRENCY),
-                                      required=True)
-TALER_DIGITS = 2
-TALER_PREDEFINED_ACCOUNTS = ['Tor', 'GNUnet', 'Taler', 'FSF', 'Tutorial']
-TALER_EXPECTS_DONATIONS = ['Tor', 'GNUnet', 'Taler', 'FSF']
-TALER_SUGGESTED_EXCHANGE = tc.value_string("bank", "suggested_exchange")
-
-logging.info("currency: '%s'", TALER_CURRENCY)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]