Skip to content

ZenithClown/flask-docker-template

Repository files navigation

Flask Template
(python, docker, rest-api, flake8)

GitHub issues GitHub forks GitHub stars GitHub license Travis CI Build*

A simple flask-template for REST-API design and implementation. Please include the Template Link in your design. Template includes .gitignore and .gitattributes related to python and flask-api model. You can also update/change/delete LICENSE as required. Other files are related to docker and flake8 (code linting) is included with basic setup. The template is built on GitHub, thus .github directory is included with issue template, and workflows directory.

NOTE: some optional usage, specifications, and helpful links are as below:

  1. You can add GitHub Repository Badges from Shields IO - if this is a Public Repository;
  2. TAB (size = 4) has been used for indentation.
  3. .github/workflows is added however, it is recomended that you create your own workflows either using GitHub Actions or on your own.
  4. Basic docker files are added for convention, modify it as per requirement. Recomended to delete the file, if not required.
  5. The repository uses markdown instead of rich text format, so make necessary changes to file extension/type as required.
  6. Engine Configuration for SQLAlchemy Documentation.

Quick Start Guide

Introduced in 2019, users can now create a repository from templates in GitHub. To do this, simply head over to any repository settings and enable "Template Repository" from the Options Menu. When creating a new repository from this template, you can just click on Use this template available in this repository (refer the picture below).

use_this_template_demo

Creating a NEW Repository from Template

Template Repository is not limited to GitHub, and you can setup your own local-file structure for the same. The following describes the usage of rsync which is available in most linux distros, more information on rsync.

# Note the use of rsync
rsync -rh ~/source/directory /destination/directory

Generate Template using cookiecutter

cookiecutter is an excellet module for creating projects from templates. The process can be done so locally (as shown below), or using command line utility cookiecutter https://github.com/ZenithClown/flask-docker-template/tree/cookiecutter by directly accesing the repository from GitHub.

using_cookiecutter_locally_demo

Setup Information

Configure the application by setting ENVIRONMENT VARIABLES as required. Sample variables are provided in .env.bkp, however for production grade application is is recomended that you set them at $PATH. Start the application using python manage.py which serves the port 0.0.0.0:5000 by default.


* Travis CI allows only 10k Credits on free-tier. The build might be old, please re-enable and check service if required.