albertyw/base-flask


Base Flask/uWSGI/nginx setup

License: MIT

Language: JavaScript

Keywords: flask, nginx, python-3, template, uwsgi


Base Flask Setup

Codeship Status for albertyw/base-flask Updates Code Climate Test Coverage Hound CI

This is a base Flask/uWSGI/nginx setup, useful as a skeleton for building simple web apps from. This is meant to be used for websites, as opposed to pure JSON sites which would be better developed using a different language or framework (e.g. sanic).

Features

  • Developed specifically for Python 3
  • Minimal but up-to-date python dependencies
  • 100% test coverage
  • No issues from Code Climate
  • PEP8 compliant
  • Documented setup and usage procedures
  • Includes setting up secure and fast nginx/uwsgi in production
  • Docker support

Setup

Modify and run bin/scaffold.sh to create a copy of base-flask for your project needs, then run bin/setup.sh to set up the host.

Base-flask is designed to work with a minimally sized AWS EC2 or DigitalOcean instance, running a modern version of Ubuntu (18.04 LTS recommended).

CDN

A CDN like cloudflare can also be added on to boost speed. A good cloudflare setup would be to use full SSL encryption and to install an origin certificate so that requests are encrypted end-to-end.

Development

Setup (using virtualenvwrapper):

mkvirtualenv app -p python3.5
pip install -r requirements.txt
pip install -r requirements-test.txt
ln -s .env.development .env

Spinning up the server:

python app/serve.py

Running tests:

mypy app --ignore-missing-imports
coverage run -m unittest discover

CI/CD

This repo uses:

# Switch to python 3
pyenv local 3.5
pip install -r requirements.txt
pip install -r requirements-test.txt
ln -s .env.development .env

# Test
flake8
coverage run -m unittest discover
coverage report
codeclimate-test-reporter

# Deployment
ssh example.com website/bin/deploy.sh

Building and starting the docker container

docker build -t $PROJECT_NAME:test .
docker run -t -i -p 127.0.0.1:5000:5000 $PROJECT_NAME:test

Production

Setup

bin/setup.sh

Deploment

bin/deploy.sh

Project Statistics

Sourcerank 5
Repository Size 494 KB
Stars 4
Forks 0
Watchers 2
Open issues 3
Dependencies 13
Contributors 1
Tags 30
Created
Last updated
Last pushed

Top Contributors See all

Albert Wang

Recent Tags See all

v3.0.0 September 02, 2018
v2.4.2 August 12, 2018
v2.4.1 July 14, 2018
v2.4.0 July 14, 2018
v2.3.0 June 17, 2018
v2.2.0 June 13, 2018
v2.1.4 May 21, 2018
v2.1.3 May 03, 2018
v2.1.2 March 19, 2018
v2.1.1 February 12, 2018
v2.1.0 January 21, 2018
v2.0.2 October 28, 2017
v2.0.1 October 28, 2017
v2.0.0 August 27, 2017
v1.7.0 July 14, 2017

Something wrong with this page? Make a suggestion

Last synced: 2018-09-10 03:31:19 UTC

Login to resync this repository