gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-merchant-demos] branch master updated (30bad63 -> b0f3d60)


From: gnunet
Subject: [taler-taler-merchant-demos] branch master updated (30bad63 -> b0f3d60)
Date: Sun, 06 Sep 2020 11:20:17 +0200

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

grothoff pushed a change to branch master
in repository taler-merchant-demos.

    from 30bad63  exit if Web app has configuration error
     new 063e68e  fix #6510
     new c93ad0e  README: Added a section and moved an instruction
     new a1f8eb2  Merge branch 'torsten-redesign' of 
git+ssh://git.taler.net/taler-merchant-demos into torsten-redesign
     new fd74c41  generate proper error message on configuration error (fixes 
#6512)
     new 48aad32  add lxml dependency (#6511)
     new 78e7715  fix #6507
     new dd45ad4  remove from depencencies
     new 23cb94a  -trial fix
     new a2314b9  -trial fix
     new 4aaa49e  -trial fix
     new 9ab9af9  -trial fix
     new 24a7643  -trial fix
     new 9cf423b  -trial fix
     new b0f3d60  merge

The 14 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md                                 | 18 +++++++++-------
 bin/taler-merchant-demos                  | 35 ++++++++++++++++++++-----------
 setup.py                                  |  8 +++----
 talermerchantdemos/blog/blog.py           | 21 ++++++++++++++-----
 talermerchantdemos/donations/donations.py | 18 ++++++++++++----
 talermerchantdemos/survey/survey.py       | 19 +++++++++++++----
 6 files changed, 83 insertions(+), 36 deletions(-)

diff --git a/README.md b/README.md
index cb5bba6..967bafa 100644
--- a/README.md
+++ b/README.md
@@ -6,19 +6,19 @@ Step 1: `cd` into the directory:<br/>
 > ```$ cd taler-merchant-demos```
 
 <br/>
-Step 2: configure it using:<br/>
+Step 2: Ensure Python3.5 or above is installed using a command like:<br/>
 
-> ```$ ./configure --destination=local```
+> ```$ sudo apt install python3.8 -y```
 
 <br/>
-Step 3: Ensure Python3.5 or above is installed using a command like:<br/>
+Step 3: Ensure Python3 Pip is installed:<br/>
 
-> ```$ sudo apt install python3.8 -y```
+> ```$ sudo apt install python3-pip -y```
 
 <br/>
-Step 4: Ensure Python3 Pip is installed:<br/>
+Step 4: configure it using:<br/>
 
-> ```$ sudo apt install python3-pip -y```
+> ```$ ./configure --destination=local```
 
 Step 5: Install UWSGI<br>
 *NOTE: DO NOT INSTALL USING PIP2 (on my system, that is what the pip command 
uses) - INSTALL IT USING PIP3*
@@ -29,9 +29,13 @@ Step 5: Install UWSGI<br>
 Step 6: Install LXML
 *NOTE: DO NOT INSTALL USING PIP2 (on my system, that is what the pip command 
uses) - INSTALL IT USING PIP3*
 
-> ```pip3 install lxml```
+> ```$ pip3 install lxml```
 <br>
 
+## Quick Install for the dependencies
+Here's one command to automatically install all dependencies at once:
+> ```$ sudo apt install python3.8 python3-pip -y; pip3 install lxml uwsgi; 
./configure --destination=local```
+
 ## Configuring the demo
 *This is just how I did it, and not the main method of doing it*
 
diff --git a/bin/taler-merchant-demos b/bin/taler-merchant-demos
index cf56d81..7ed69d7 100755
--- a/bin/taler-merchant-demos
+++ b/bin/taler-merchant-demos
@@ -27,7 +27,7 @@ import argparse
 import sys
 import os
 import site
-from taler.util.talerconfig import TalerConfig
+from taler.util.talerconfig import TalerConfig, ConfigurationError
 
 LOGGER = logging.getLogger(__name__)
 # No perfect match to our logging format, but good enough ...
@@ -60,7 +60,11 @@ def handle_serve_uwsgi(config, whichShop):
         params.extend(["--chmod-socket="+mode])
         os.makedirs(os.path.dirname(spec), exist_ok=True)
     logging.info("launching uwsgi with argv %s", params[1:])
-    os.execlp(*params)
+    try:
+        os.execlp(*params)
+    except:
+        sys.stderr.write("Failed to start uwsgi. Please make sure to install 
uwsgi for Python3.")
+        sys.exit(1)
 
 ##
 # This function interprets the 'serve-http' subcommand.
@@ -69,15 +73,22 @@ def handle_serve_uwsgi(config, whichShop):
 # @param args command line options.
 def handle_serve_http(config, whichShop, port=None):
     if port is None:
-        port = config[whichShop]["http_port"].value_int(required=True)
+        try:
+            port = config[whichShop]["http_port"].value_int(required=True)
+        except ConfigurationError as ce:
+            print(ce)
+            exit(1)
     spec = ":%d" % (port,)
-    os.execlp("uwsgi", "uwsgi",
-              "--master",
-              "--die-on-term",
-              "--log-format", UWSGI_LOGFMT,
-              "--http", spec,
-              "--need-app",
-              "--module", "talermerchantdemos.{}:app".format(whichShop))
+    try:
+        os.execlp("uwsgi", "uwsgi",
+                  "--master",
+                  "--die-on-term",
+                  "--log-format", UWSGI_LOGFMT,
+                  "--http", spec,
+                  "--module", "talermerchantdemos.{}:app".format(whichShop))
+    except:
+        sys.stderr.write("Failed to start uwsgi. Please make sure to install 
uwsgi for Python3.")
+        sys.exit(1)
 
 @click.command("Global shop launcher")
 @click.option("--config", help="Configuration file", required=False)
@@ -94,7 +105,7 @@ def demos(config, serve_http, port, serve_uwsgi, which_shop):
     config_obj = TalerConfig.from_file(os.environ.get("TALER_CONFIG_FILE"))
     if serve_http: # port was given
         handle_serve_http(config_obj, which_shop, port)
-        return
-    handle_serve_uwsgi(config_obj, which_shop)
+    else:
+        handle_serve_uwsgi(config_obj, which_shop)
 
 demos()
diff --git a/setup.py b/setup.py
index 07bd8a7..deeba73 100755
--- a/setup.py
+++ b/setup.py
@@ -1,12 +1,12 @@
 from setuptools import setup, find_packages
 
 setup(name='talermerchantdemos',
-      version='0.6.0pre1',
+      version='0.8.0',
       description='Example blog/donations/survey sites for GNU Taler',
       url='git://taler.net/taler-merchant-demos',
-      author=['Marcello Stanisci', 'Florian Dold'],
-      author_email=['ms@taler.net', 'florian@dold.me'],
-      license='GPL',
+      author=['Marcello Stanisci', 'Florian Dold', 'Christian Grothoff'],
+      author_email=['ms@taler.net', 'florian@dold.me', 'cg@taler.net'],
+      license='AGPL',
       packages=find_packages(),
       install_requires=["Flask>=0.10",
                         "beautifulsoup4",
diff --git a/talermerchantdemos/blog/blog.py b/talermerchantdemos/blog/blog.py
index c024380..c54a8d6 100644
--- a/talermerchantdemos/blog/blog.py
+++ b/talermerchantdemos/blog/blog.py
@@ -25,20 +25,31 @@ import uuid
 import base64
 import flask
 import time
+import sys
 from urllib.parse import urljoin, urlencode, urlparse
-from taler.util.talerconfig import TalerConfig
+from taler.util.talerconfig import TalerConfig, ConfigurationError
 from ..blog.content import ARTICLES, get_article_file, get_image_file
 from talermerchantdemos.httpcommon import backend_get, backend_post
 
+if not sys.version_info.major == 3 and sys.version_info.minor >= 6:
+    print("Python 3.6 or higher is required.")
+    print("You are using Python {}.{}.".format(sys.version_info.major, 
sys.version_info.minor))
+    sys.exit(1)
+
+
 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-app = flask.Flask(__name__, template_folder=BASE_DIR)
+app = flask.Flask(__name__, template_folder=BASE_DIR, static_folder=BASE_DIR + 
'/../static/')
 app.secret_key = base64.b64encode(os.urandom(64)).decode("utf-8")
 
 LOGGER = logging.getLogger(__name__)
 TC = TalerConfig.from_env()
-BACKEND_BASE_URL = TC["frontends"]["backend"].value_string(required=True)
-CURRENCY = TC["taler"]["currency"].value_string(required=True)
-APIKEY = TC["frontends"]["backend_apikey"].value_string(required=True)
+try:
+    BACKEND_BASE_URL = TC["frontends"]["backend"].value_string(required=True)
+    CURRENCY = TC["taler"]["currency"].value_string(required=True)
+    APIKEY = TC["frontends"]["backend_apikey"].value_string(required=True)
+except ConfigurationError as ce:
+    print(ce)
+    exit(1)
 ARTICLE_AMOUNT = CURRENCY + ":0.5"
 BACKEND_URL = urljoin(BACKEND_BASE_URL, "instances/blog/")
 
diff --git a/talermerchantdemos/donations/donations.py 
b/talermerchantdemos/donations/donations.py
index afca27c..7d4c9c6 100644
--- a/talermerchantdemos/donations/donations.py
+++ b/talermerchantdemos/donations/donations.py
@@ -24,9 +24,15 @@ import os
 import time
 import traceback
 import urllib
-from taler.util.talerconfig import TalerConfig
+from taler.util.talerconfig import TalerConfig, ConfigurationError
 from urllib.parse import urljoin
 from ..httpcommon import backend_post, backend_get
+import sys
+
+if not sys.version_info.major == 3 and sys.version_info.minor >= 6:
+    print("Python 3.6 or higher is required.")
+    print("You are using Python {}.{}.".format(sys.version_info.major, 
sys.version_info.minor))
+    sys.exit(1)
 
 LOGGER = logging.getLogger(__name__)
 
@@ -37,9 +43,13 @@ app.debug = True
 app.secret_key = base64.b64encode(os.urandom(64)).decode("utf-8")
 
 TC = TalerConfig.from_env()
-BACKEND_BASE_URL = TC["frontends"]["backend"].value_string(required=True)
-CURRENCY = TC["taler"]["currency"].value_string(required=True)
-APIKEY = TC["frontends"]["backend_apikey"].value_string(required=True)
+try:
+    BACKEND_BASE_URL = TC["frontends"]["backend"].value_string(required=True)
+    CURRENCY = TC["taler"]["currency"].value_string(required=True)
+    APIKEY = TC["frontends"]["backend_apikey"].value_string(required=True)
+except ConfigurationError as ce:
+    print(ce)
+    exit(1)
 
 app.config.from_object(__name__)
 
diff --git a/talermerchantdemos/survey/survey.py 
b/talermerchantdemos/survey/survey.py
index 25b97ad..562b817 100644
--- a/talermerchantdemos/survey/survey.py
+++ b/talermerchantdemos/survey/survey.py
@@ -24,17 +24,28 @@ import logging
 from urllib.parse import urljoin
 import flask
 import traceback
-from taler.util.talerconfig import TalerConfig
+from taler.util.talerconfig import TalerConfig, ConfigurationError
 from ..httpcommon import backend_get, backend_post
+import sys
+
+if not sys.version_info.major == 3 and sys.version_info.minor >= 6:
+    print("Python 3.6 or higher is required.")
+    print("You are using Python {}.{}.".format(sys.version_info.major, 
sys.version_info.minor))
+    sys.exit(1)
 
 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
 app = flask.Flask(__name__, template_folder=BASE_DIR)
 app.debug = True
 app.secret_key = base64.b64encode(os.urandom(64)).decode('utf-8')
 TC = TalerConfig.from_env()
-BACKEND_URL = TC["frontends"]["backend"].value_string(required=True)
-CURRENCY = TC["taler"]["currency"].value_string(required=True)
-APIKEY = TC["frontends"]["backend_apikey"].value_string(required=True)
+try:
+    BACKEND_URL = TC["frontends"]["backend"].value_string(required=True)
+    CURRENCY = TC["taler"]["currency"].value_string(required=True)
+    APIKEY = TC["frontends"]["backend_apikey"].value_string(required=True)
+except ConfigurationError as ce:
+    print(ce)
+    exit(1)
+
 app.config.from_object(__name__)
 LOGGER = logging.getLogger(__name__)
 INSTANCED_URL = urljoin(BACKEND_URL, f"instances/survey/")

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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