smol-party-2

0
0
0
3
Python
public

Smol Party

Directory Structure

What’s in this repo…

.
├── README.md       # You're reading me!
│
├── Makefile        # Setup, linting, and common commands here.
│
├── pyproject.toml  # Python dependendencies and linter settings.
├── poetry.lock     # Dependency lock file, this gets updated programatically by poetry.
│ 
├── settings.toml   # Application environment variables.
├── secrets.toml    # SECRET application environment variables (NOT IN GIT!)
│ 
├── app.py          # The primary python source file. The backend is (mostly) here.
├── templates
│   └── index.html  # The primary html jinja template. The front-end is (mostly) here.
├── static
│   ├── app.js      # The js source file to accompany index.html.
│   ├── app.css     # The css source file to accompany index.html.
│   └── themes      # Themes for the events. Only one of this is used at a time.
│ 
├── migrations      # Generated migrations (see below).
└── instance        # SQLite Databases for local development.

Getting Started

Prereqs

  • pyenv
  • virtualenv
  • pyenv-virtualenv

Setup

First step is setting up your python env and development DB with the Makefile.

  • Creates a pyenv-virtualenv called smol-party-3.10.14
  • Sets the .python-version file
  • Inializes a SQLite development db in instance/
make setup

Next you’ll need to set up a secrets.toml in the root directory with the necessary secrets for development.

It should look something like this:

[default]
TWILIO_ACCOUNT_SID = ""
TWILIO_AUTH_TOKEN = ""

[development]
SECRET_KEY = "e5bbe2b2c0a1052543f93eea3595735e"
SQLALCHEMY_DATABASE_URI = 'sqlite:///development.db'

Running Locally

Runs in debug mode with FLASK_ENV=development and will use environment
variables from the [development] seconds of the settings.toml and
secrets.toml files.

make up

Migrations

Create a new migration based on prod.

FLASK_ENV=production-local poetry run flask db migrate -m "New migration."

Apply it locally.

poetry run flask db upgrade

Apply it in prod.

FLASK_ENV=production-local poetry run flask db upgrade
v0.3.3[beta]