Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (39 sloc) 1.34 KB
#!/usr/bin/env python
Bootstrap and serve your application. If you're in a development environment,
envoke the script with:
$ python
In a production environment, your application can be run with the `gevent`
Python library:
$ python --gevent
import argparse
from gevent.wsgi import WSGIServer
from app import create_app
def parse_arguments():
"""Parse any additional arguments that may be passed to ``."""
parser = argparse.ArgumentParser()
parser.add_argument('--gevent', action='store_true',
help="Run gevent's production server.")
parser.add_argument('--port', type=int, default=5000,
help="An integer for the port you want to use.")
args = parser.parse_args()
return args
def serve_app(environment):
Serve your application. If `dev_environment` is true, then the
application will be served using gevent's WSGIServer.
app = create_app()
port = environment.port
if environment.gevent:
# Use the $PORT variable on heroku's environment.
http_server = WSGIServer(('', port), app)
else:, port=port)
def main():
dev_environment = parse_arguments()
if __name__ == '__main__':