README.rst | 2 +- runserver.py | 44 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 8 deletions(-)
New commits: commit 52ae1e1c03281eefbbf6cd2de983815063797327 Merge: d33ad98 af5cd81 Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Fri Jan 29 23:15:42 2016 +0100
Merge pull request #57 from fedora-infra/improved_script
Rework the runserver script to offer more options
commit af5cd8191ddf135dd68e684d9c9f8974b51b6dde Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Thu Jan 28 00:22:52 2016 +0100
Use 127.0.0.1 instead of 0.0.0.0 in the README and runserver.py
diff --git a/README.rst b/README.rst index 5aa925e..96a39c8 100644 --- a/README.rst +++ b/README.rst @@ -81,7 +81,7 @@ There are 2 ways to start the application: * with apache
-* How to start without apache on http://0.0.0.0:5000 (useful for development): +* How to start without apache on http://127.0.0.1:5000 (useful for development):
::
diff --git a/runserver.py b/runserver.py index 25c26c8..03becc0 100755 --- a/runserver.py +++ b/runserver.py @@ -43,4 +43,4 @@ if args.config: os.environ['FEDORA_ELECTIONS_CONFIG'] = config
APP.debug = True -APP.run(host='0.0.0.0', port=int(args.port)) +APP.run(host='127.0.0.1', port=int(args.port))
commit 6480b3b6212866d57b4688b1964f0d4e45b7d126 Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Wed Jan 27 11:09:11 2016 +0100
Adjust README to match with the instructions of runserver.py
diff --git a/README.rst b/README.rst index 42dc6de..5aa925e 100644 --- a/README.rst +++ b/README.rst @@ -81,7 +81,7 @@ There are 2 ways to start the application: * with apache
-* How to start without apache on localhost:5000 (useful for development): +* How to start without apache on http://0.0.0.0:5000 (useful for development):
::
commit 9aea8e732d18962d99c99cd0233ece5428887e9c Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Wed Jan 27 11:08:55 2016 +0100
Remove mentions to pkgdb2 since this is now an elections file
diff --git a/runserver.py b/runserver.py index b24c408..25c26c8 100755 --- a/runserver.py +++ b/runserver.py @@ -10,7 +10,7 @@ import os
parser = argparse.ArgumentParser( - description='Run the packages2 app') + description='Run the Fedora election app') parser.add_argument( '--config', '-c', dest='config', help='Configuration file to use for packages.') @@ -21,7 +21,7 @@ parser.add_argument( parser.add_argument( '--profile', dest='profile', action='store_true', default=False, - help='Profile the packages2 application.') + help='Profile the application.') parser.add_argument( '--port', '-p', default=5000, help='Port for the flask application.')
commit b0ccbb024fe8f50737eefa47f229dd909b61f83d Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Sun Jan 24 09:36:07 2016 +0100
Rework the runserver script to offer more options
diff --git a/runserver.py b/runserver.py index 922f528..b24c408 100755 --- a/runserver.py +++ b/runserver.py @@ -1,16 +1,46 @@ -#!/usr/bin/env python -import __main__ -__main__.__requires__ = ['SQLAlchemy >= 0.7', 'jinja2 >= 2.4'] +#!/usr/bin/env python2 + +# These two lines are needed to run on EL6 +__requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4'] import pkg_resources
+import argparse import sys -from werkzeug.contrib.profiler import ProfilerMiddleware +import os + + +parser = argparse.ArgumentParser( + description='Run the packages2 app') +parser.add_argument( + '--config', '-c', dest='config', + help='Configuration file to use for packages.') +parser.add_argument( + '--debug', dest='debug', action='store_true', + default=False, + help='Expand the level of data returned.') +parser.add_argument( + '--profile', dest='profile', action='store_true', + default=False, + help='Profile the packages2 application.') +parser.add_argument( + '--port', '-p', default=5000, + help='Port for the flask application.') + +args = parser.parse_args()
from fedora_elections import APP -APP.debug = True
-if '--profile' in sys.argv: +if args.profile: + from werkzeug.contrib.profiler import ProfilerMiddleware APP.config['PROFILE'] = True APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30])
-APP.run() +if args.config: + config = args.config + if not config.startswith('/'): + here = os.path.join(os.path.dirname(os.path.abspath(__file__))) + config = os.path.join(here, config) + os.environ['FEDORA_ELECTIONS_CONFIG'] = config + +APP.debug = True +APP.run(host='0.0.0.0', port=int(args.port))
elections-devel@lists.stg.fedorahosted.org