~jgillis/python-flask-cookiecutter

Opinionated cookiecutter template for a Python Flask app
c006b5a4 — Joris Gillis 4 years ago
Documenting how to use the generated project
17072c07 — Joris Gillis 4 years ago
Updating defaults
8d04be28 — Joris Gillis 4 years ago
Producing a docker image

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~jgillis/python-flask-cookiecutter
read/write
git@git.sr.ht:~jgillis/python-flask-cookiecutter

You can also use your local clone with git send-email.

#Python Flask template

This is a Cookiecutter template to bootstrap a Python Flask based application.

pip install --user cookiecutter
cookiecutter https://git.sr.ht/~jgillis/python-flask-cookiecutter

Answer the questions prompted by cookiecutter and your project will be generated.

Start by initiating a git repository in your generated project:

git init
git add *
git commit -m "Initial commit"
git tag v0.0.1

Run the init goal of the Makefile. This installs all dependencies and creates a virtual environment:

make init

Enter the virtual environment

poetry shell

Build a docker image:

make clean docker

In the dist folder you should find three files. One tar file, containing the docker image. One tar.gz file containing the source distribution of your Python package. One whl file containing the binary distribution of your Python package. Now you can either use poetry publish to publish the Python artifacts to PyPI or your local repository. The docker artifact can be deployed to your docker registry. Or you use docker load < <your-project>-<version>.tar to load it into a Docker engine.

#Note on package names

Do note the difference between python_package_name and module_name. The former is the name of you Python package (as used by pip and PyPi). The latter is the name of the Python module.
For example, py-project is a valid python_package_name and py_project (note the dash became an underscore) is a module name. Make sure that python_package_name and module_name are equivalent, except that dashes in the python package name are replaced by underscores in the module name.

Do not follow this link