Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a port flag to the endpoints example #321

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion managed_vms/endpoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
various authentication methods.
"""

import argparse
import base64
import json

Expand Down Expand Up @@ -86,6 +87,10 @@ def unexpected_error(e):


if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Run your API Backend')
parser.add_argument('--port', type=int, help='Port to run on')
parser.add_argument('--debug', type=bool, help='Run in debug mode')
parsed = parser.parse_args()
# This is used when running locally. Gunicorn is used to run the
# application on Google App Engine. See entrypoint in app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
app.run(host='127.0.0.1', port=parsed.port, debug=parsed.debug)