Deployment¶
Production deployment¶
The recommended way to use porter
in production is through a production-grade WSGI server, such as gunicorn. To do so simply define an instance of porter.services.ModelApp
in your python script and then point gunicorn to it.
For example, given a python script app.py
closing with:
model_app = ModelApp(...)
Then for production use, either in a shell script or on the command line, invoke:
gunicorn app:model_app
For more options, see e.g. deployment options in the Flask documentation.
Local testing¶
For local development and debugging, it is appropriate to run the app’s development server directly:
model_app = ModelApp(...)
if __name__ == '__main__':
model_app.run()