/Flask-Skeleton-App

A skeleton Linux, CherryPy/Flask, MongoDB, Python stack

Primary LanguagePython

A skeleton Flask, CherryPy, MongoDB app.

Requirements

  • Flask, easy_install flask
  • CherryPy WSGI Server, easy_install cherrypy (for production)

Installation

  • Run the install script python install.py and choose the port the app will run at (default is 5000)
  • Configure MongoDB database settings in config.py (optional)

Running

Flask/Werkzeug Server (for development)

The app can be run through the Werkzeug WSGI server that comes with Flask. To run it, execute python flask_app.py. Provided you have set DEBUG = True in your config.py file, this option will give you an interactive debugger and your app will be reloaded if changes to source files are detected.

CherryPy WSGI Server (for production)

  1. Run ./start_server.sh. This will launch cherryd with settings coming from cherrypy.conf that uses an 'in-between' script create_flask_app.py to attach the Flask Object to the server
  2. A file, cherrypy.pid will be created that has the id of the process running
  3. Calling ./stop_server.sh will read the .pid file and kill the process waiting for child threads to terminate