Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

anu-act-health-covid19-support/hospital-demand-webapp-backup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask React SPA

Status

Build Status

screenshot

React v16 Frontend

The frontend is heavily inspired by react boilerplate, and indeed borrows a good chunk of boilerplate from it.

Entry point is at frontend/app/index.js.

Flask Backend

The backend is structured using the Application Factory Pattern, in conjunction with a little bit of declarative configuration in backend/config.py (for ordered registration of extensions, and auto-detection of views, models, serializers, model admins and cli commands). The entry point is the create_app() method in backend/app.py (wsgi.py in production).

Ansible Production Deployment

  • CentOS/RHEL 7.x
  • Python 3.6 (provided by the IUS Project)
  • PostgreSQL 9.6
  • Redis 3.2
  • NGINX + uWSGI + supervisord
  • Lets Encrypt HTTPS
  • Email sending via Postfix with SSL and OpenDKIM

Local Development QuickStart:

Using docker-compose

Dependencies:

  • docker and docker-compose (at least docker engine v1.13)
# install
$ git clone git@github.com:briancappello/flask-react-spa.git
$ cd flask-react-spa

# configure (the defaults are fine for development)
$ edit `backend/config.example.py` and save as `backend/config.py`
$ edit `frontend/app/config.example.js` and save as `frontend/app/config.js`

# run it
$ docker-compose up --build  # grab a coffee; bootstrapping takes a while the first time

Once it's done building and everything has booted up:

Running locally

This assumes you're on a reasonably standard *nix system. Windows might work if you know what you're doing, but you're on your own there.

Dependencies:

  • Python 3.6+
  • Your virtualenv tool of choice (strongly recommended)
  • PostgreSQL or MariaDB (MySQL)
  • Redis (used for sessions persistence and the Celery tasks queue)
  • node.js & npm (v6 or later recommended, only required for development)
  • MailHog (not required, but it's awesome for testing email related tasks)
# install
$ git clone git@github.com:briancappello/flask-react-spa.git
$ cd flask-react-spa
$ mkvirtualenv -p /path/to/python3 flask_react_spa
$ pip install -r requirements.txt
$ pip install -r requirements-dev.txt  # for tests and sphinx docs

# configure
$ edit `backend/config.example.py` and save as `backend/config.py`
$ edit `frontend/app/config.example.js` and save as `frontend/app/config.js`

# set up database
$ sudo -u postgres -i psql
postgres=# CREATE USER flask_api WITH PASSWORD 'flask_api';
postgres=# CREATE DATABASE flask_api;
postgres=# GRANT ALL PRIVILEGES ON DATABASE flask_api TO flask_api;
postgres=# \q  # (quit)

# run db migrations
$ python manage.py db upgrade

# load db fixtures (optional)
$ python manage.py db fixtures fixtures.json

# frontend dev server:
$ npm install
$ npm run start

# backend dev server:
$ python manage.py run

# backend celery workers:
$ python manage.py celery worker
$ python manage.py celery beat

Full Documentation

Run make docs and browse to http://localhost:5500

Sources are in the /docs folder.

FIXME: publish to GitHub Pages.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 57.1%
  • JavaScript 34.9%
  • HTML 3.7%
  • CSS 1.8%
  • Shell 1.1%
  • Ruby 1.0%
  • Other 0.4%