From de17e44bf91f05446f1fd33c8eab01d4aa7ec577 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Apr 23 2016 06:26:16 +0000 Subject: [PATCH 1/2] add runserver.py script with host & port args This changes the way you run a dev server, with the addition of runserver.py in the root dir of the project. runserver.py now also has two arguments port and host allowing the developer to choose the port and host that their dev instance is running on. The Readme is also updated adding the new way to start the devserver, and also removing a few trailing white spaces --- diff --git a/README.rst b/README.rst index c4b5f3d..2cf15e9 100644 --- a/README.rst +++ b/README.rst @@ -1,14 +1,15 @@ -Fedora Hubs will provide a communication and collaboration center for Fedora -contributors of all types. The idea is that contributors will be able to visit -Hubs to check on their involvements across Fedora, discover new places that they +Fedora Hubs will provide a communication and collaboration center for Fedora +contributors of all types. The idea is that contributors will be able to visit +Hubs to check on their involvements across Fedora, discover new places that they can contribute, and more. -Hubs is currently under development, and you can see the progress on the +Hubs is currently under development, and you can see the progress on the Development instance here: http://209.132.184.98 Mailing List ============ -We have a mailing list here: https://lists.fedoraproject.org/archives/list/hubs-devel@lists.fedoraproject.org/ +We have a mailing list here: +https://lists.fedoraproject.org/archives/list/hubs-devel@lists.fedoraproject.org Hacking @@ -44,7 +45,7 @@ OK -- with that done, now install the dependencies from PyPI:: With that, try running the app with:: $ PYTHONPATH=. python populate.py # To create the db - $ PYTHONPATH=. python hubs/app.py # To run the dev server + $ PYTHONPATH=. python runserver.py # To run the dev server And then navigate to http://localhost:5000/ @@ -77,11 +78,11 @@ Some credentials... ------------------- You need to add a new file to the ``fedmsg.d/`` directory. -Call it ``fedmsg.d/credentials.py``. It's needed to query FAS +Call it ``fedmsg.d/credentials.py``. It's needed to query FAS for information about other users. When we deploy this thing to production, we'll use a system account for this but for now, just use your personal account. You don't want to accidentally share this -with anyone else. so be sure to keep it private. It should have +with anyone else. so be sure to keep it private. It should have contents like this:: config = { diff --git a/hubs/app.py b/hubs/app.py index 375816d..3732eea 100755 --- a/hubs/app.py +++ b/hubs/app.py @@ -480,7 +480,3 @@ def hub_leave(hub): return flask.abort(400) session.commit() return flask.redirect(flask.url_for('hub', name=hub.name)) - - -if __name__ == '__main__': - app.run(debug=True) diff --git a/runserver.py b/runserver.py new file mode 100755 index 0000000..54e1c5f --- /dev/null +++ b/runserver.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python2 + +import argparse +import sys +import os + +parser = argparse.ArgumentParser( + description='Run the Hubs app') +parser.add_argument( + '--port', '-p', default=5000, + help='Port for Hubs to run on.') +parser.add_argument( + '--host', default="127.0.0.1", + help='Hostname to listen on. When set to 0.0.0.0 the server is available \ + externally. Defaults to 127.0.0.1 making the it only visible on \ + localhost') + +args = parser.parse_args() + +from hubs.app import app + +app.run(debug=True, host=args.host, port=int(args.port)) From 4c96779dae6bf0fc4179c029ade2511092eea4ee Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Apr 23 2016 06:26:16 +0000 Subject: [PATCH 2/2] removed the PYTHONPATH bit from the readme --- diff --git a/README.rst b/README.rst index 2cf15e9..7fe3e92 100644 --- a/README.rst +++ b/README.rst @@ -44,8 +44,8 @@ OK -- with that done, now install the dependencies from PyPI:: With that, try running the app with:: - $ PYTHONPATH=. python populate.py # To create the db - $ PYTHONPATH=. python runserver.py # To run the dev server + $ python populate.py # To create the db + $ python runserver.py # To run the dev server And then navigate to http://localhost:5000/