Giter Club home page Giter Club logo

docker-flask's Introduction

docker-flask

Flask in Docker

Usage

To run hello world app, :8080 provides HTTP endpoint (to uWSGI), and :9000 provides uWSGI endpoint. So, let's try accessing via HTTP:

docker run -p 127.0.0.1:8080:8080 ypcs/flask:latest

now try to open http://127.0.0.1:8080/ , you should see familiar greeting.

To publish your own app, mount your app to /app, and provide FLASK_APP environment variable with correct value.

Eg.

docker run -v $(pwd)/myapp:/app -e FLASK_APP=myapp:app -p 127.0.0.1:8080:8080 ypcs/flask:latest

if you had app code like

myapp/myapp.py:

from flask import Flask
app = Flask(__name__)

@app.route("/")
def some_view():
    return "Hello myapp!"

Usually you shouldn't expose this HTTP endpoint directly to internet, but use eg. ypcs/nginx:latest as a reverse proxy.

Live reload

By default, you can manually reload the application by touching /tmp/reload-app. If you want your application to reload automatically after every save, set FLASK_RELOAD as true.

docker-flask's People

Contributors

frimro avatar ypcs avatar

Watchers

 avatar  avatar

Forkers

seravo

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.