No description
Find a file Use this template
2025-03-09 11:41:17 +01:00
static initial commit 2025-03-09 11:41:17 +01:00
templates initial commit 2025-03-09 11:41:17 +01:00
.gitignore initial commit 2025-03-09 11:41:17 +01:00
__init__.py initial commit 2025-03-09 11:41:17 +01:00
app.py initial commit 2025-03-09 11:41:17 +01:00
blueprintname.py initial commit 2025-03-09 11:41:17 +01:00
cache.py initial commit 2025-03-09 11:41:17 +01:00
README.md initial commit 2025-03-09 11:41:17 +01:00
requirements.txt initial commit 2025-03-09 11:41:17 +01:00

Python Template

An opinionated starter project for flask python projects. It contains code for a new [Flask Blueprint]https://flask.palletsprojects.com/en/stable/blueprints/).

DO NOT PUSH PROJECT-SPECIFIC CHANGES

Project setup

  1. Set up your Debian (for other environments, search for counterpart instructions)

    # update repositories
    $ sudo apt update
    
    # install python stuff
    $ sudo apt install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools python3-venv
    

For MacOS: https://docs.python.org/3/using/mac.html

  1. Install dependencies and set up the project

    # clone the project
    $ git clone git@git.sr.ht:~ayoayco/python-template [project-name]
    
    # go into the directory
    $ cd [project-name]
    
    # remove template .git stuff
    $ rm -rf .git
    
    # initialize git
    $ git init .
    
    # create python environment:
    $ python3 -m venv .venv
    
    # activate python env:
    $ . .venv/bin/activate
    
    # install dependencies
    (.venv)$ python -m pip install -r requirements.txt
    
    # create configuration from example config file
    (.venv)$ cp ./example_config.json ./config.json
    
    # rejoice!
    
  2. To start development, run the following:

    (.venv)$ flask --debug run
    

    Note: On a Mac, the default port 5000 is used by AirDrop & Handoff; you may have to turn those off

  3. After development session, deactivate the python env ``bash ` (.venv)$ deactivate