Skip to content

jorotenev/flask_docker

Repository files navigation

flask_docker

This repo contains skeleton code for a barebone Flask app. The app can be ran via docker-compose too.

Run

To run with docker-compose

The pipenv image is used. Since there's only a latest tag, below I reference a specific image build.

  • docker-compose up

Manually

  • Install pipenv
  • $ pipenv install
  • pipenv will output the folder of the new interpreter
  • In PyCharm, add a new interpreted and point to the folder from above + Scripts/pyhton
  • To run the flask app (see below the Note for PyCharm users) $ flask run

Note for PyCharm users

When running via PyCharm and assuming that pipenv is used, you need to select the correct Python interpreter.

$ pipenv shell
(some_app-tKuPD0ya) $ which python
/home/georgi/.local/share/virtualenvs/some_app-tKuPD0ya/bin/python

When creating a run configuration, select as "Module name" (the default is to execute a script) flask and as Parameters run. For older versions of the IDE, see this

Make sure to set the Working directory folder in the run config to the project folder.

Test

Example for unittest.
To run them via PyCharm

  • You need the '.env_test' file placed in the repo root with the SECRET_KEY and FLASK_ENV=testing env vars
FLASK_ENV=testing
SECRET_KEY=somesecret
  • Create a new Python test run configuration with the /tests as the Path target and the root of the repo as a working directory

About

Seed Flask project using Docker-Compose.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published