Coder Social home page Coder Social logo

flask_docker's Introduction

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

flask_docker's People

Contributors

jorotenev avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

celestialized

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.