Skip to content

dhaniboy09/docker-compose-mongodb

 
 

Repository files navigation

A MongoDB-based Flask Application

  • In this case we're going to do an application factory with Blueprints
  • Clone the app
    • Note that I'm using different container names in docker-compose.yml to avoid conflicts
  • Build the image with docker-compose build
  • Run the container with docker-compose up
  • Hit / and see the counter incrementing every time you refresh the page
  • To explore the mongodb database, open a new tab and do docker exec -it counterapp_db_2 mongo
    • Do use counter, show collections, db.counter.find()
  • To run tests, do docker exec -it counterapp_web_2 python tests.py
  • Using PDB with Docker Compose
    • Start the database as it's own demon service: docker-compose up -d db
    • Now start the application with pdb enabled: docker-compose run --service-ports web
    • You will get the live log of just the app and you can stop with CTRL-C
    • Try adding a pdb on the code
    • To stop the db docker-compose stop db

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%