TL/DR: Minimalism
∩ Interactive-REPL-driven-development
== ❤️❤️❤️.
⚠️ work in progress - for now intended only for author's own use⚠️
- purge things too specific to project this was extracted from
- fix Docker config and related to work standalone
- add a proper list of TODOs and start working on turning this into a proper generally usable starter kit
# 1.
pip install -r requirements.txt
# 2.
cp example.local_config.py local_config.py
# 3.
# edit local_config.py
# 4. (locally, on your developer machine) edit hosts file adding:
# 127.0.0.1 mindfeeder.local
# HINT: this is probably simplest ways to make browsers stfu about some cross-origin issues
Possible ways to generate values for local_config.py
JWT_SECRET_KEY
- to generate a JWT secret key run commandopenssl rand -hex 32
- to generate a random user id (key in
API_USERS
) run commandopenssl rand -hex 16
- to generate a hash for your password (DO NOT EVER store actual password in file!):
python -c "import app.auth; print(app.auth.get_password_hash('your password here'))"
- add/edit in
CORS_ORIGINS
to also have the url you're serving you dev frontend from (if any)
Run this on local machine or on dev/testing/staging server:
./run-dev.sh
# or with port and host (default 8000:0.0.0.0)
./run-dev.sh 80 127.0.0.1
Go to /api/v1/auth/login
in browser.
./test.sh
# 1. if on server, ensure you ssh-d with port tunnelled,
# eg. `-A -L 8080:localhost:8080`
# or pass one arg, port (default 8080)
./run-dev-jupyter.sh
This is JUST AN EXAMPLE!
# set up nginx
sudo cp /opt/app/example.nginx.conf /etc/nginx/sites-available/yourthing.app
sudo ln -s /etc/nginx/sites-available/yourthing.app /etc/nginx/sites-enabled/
# configure service for gunicorn + uvicorn
sudo cp /opt/app/example.systemd.confs/yourthing-api-gunicorn.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start yourthing-api-gunicorn