Skip to content

Example python app connecting to a MongoDB service for Cloud Foundry Application Cloud

Notifications You must be signed in to change notification settings

moikorg/cf-python_mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample Python Web application connecting to MongoDB

The sample is using Flask microframework and mongoengine. It is intented to test the Python support on Pivotal's Cloud Foundry.

The script tries to get the environment information to know how to connect to the MongoDB. It reads the VCAP_SERVICES information and looks for the MongoDB information.

The script writes some dummy information to the database.

The web application listens to the following URLs

  • ../env
  • ../cred
  • ../username/show --> where username is one of the dummy information username (e.g. donald, dagobert, ... see the code)

Deploy to Cloud Foundry

cf push hello-python -b https://github.com/joshuamckenty/heroku-buildpack-python.git

The Procfile file contains the instructions to CF how to start the application. The used build pack works fine for this example, other buildpacks for Python also exists, but hasn't been tested here.

The runtime.txt file contains the needed Python version and the requirements.txt files contains the Python library which has to been loaded and installed by CF.

Have fun with Python and MongoDB on cloudfoundry!!

Cheers, Mike

About

Example python app connecting to a MongoDB service for Cloud Foundry Application Cloud

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages