Git Product home page Git Product logo

rpi-nginx-uwsgi-flask's Introduction

rpi-nginx-uwsgi-flask

Docker container for hosting python Flask apps on Raspberry Pi using nginx and uWSGI.

  • This relies on python3.
  • nginx is only set up to serve on port 80; if you want SSL (which you should) either drop in a new app.conf nginx config, or run an SSL proxy in front of it.

Building on Raspberri Pi

This image is set up for building on a 32-bit Rasbian.

Usage

This container is not meaningful on its own; it needs to have your Flask app installed in it. See the example directory for a fully working sample.

To create a container for your Flask app:

  1. Create a uwsgi-app.ini in your application directory with the name of the module and app variable. For instance, a main.py with the Flask instance named app would mean the ini file would contain this:

    [uwsgi]
    module = main
    callable = app
  2. Make sure your application prerequisites are saved in a standard requirements.txt in your application directory.

  3. Copy your application directory to a subdirectory of the docker build directory.

  4. Create a Dockerfile to build a container from this one, with your app and requirements:

    FROM cyberdork33/rpi-nginx-uwsgi-flask:latest
    COPY myappdirectory /app
    RUN pip install -U -r /app/requirements.txt
  5. Build and run your container, forwarding the container port 80 to wherever you want it on your container host. For instance, to forward to port 8080:

    docker build -t myapp .
    docker run -p 8080:80 myapp

Now if you visit https://hostIP:8080/ in your browser you should see your Flask app.

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.