/cf-flask-sqlalchemy-sample

A sample Flask and SQLAlchemy application to deploy to Cloud Foundry which works out of the box.

Primary LanguagePythonMIT LicenseMIT

CF Sample Flask SQLAlchemy application

A sample Flask and SQLAlchemy application to deploy to Cloud Foundry which works out of the box.

Run locally

  1. Install Python
  2. Install Setuptools and pip (see guide above)
  3. Install Virtualenv (acconplish this by running pip install virtualenv)
  4. Run virtualenv venv
  5. Run source venv/bin/activate on Mac OS X/Linux orvenv\Scripts\activate.bat on windows
  6. Run pip install -r requirements.txt
  7. Run source env.sh
  8. Run python app.py
  9. Visit http://localhost:5000

Deploy on Cloud Foundry

  1. Install the cf CLI
  2. Create database service instance (in this example using VMWare Tanzu MySQL Broker), run cf create-service p.mysql db-small database and wait for the service instance to be deployed (cf services or cf service database)
  3. Run cf push
  4. Visit the given URL

References