This is a basic Python HTTP server to track users and their balances.
The main libraries used in this server are Flask, an HTTP web framework, and psycopg2, a PostgreSQL client.
To get started, start the database with:
$ bin/start_db.sh
Then, in a separate window, install dependencies, run migrations, and start the server:
# It's important to source this so that your interactive shell gets into the venv
$ source bin/install_deps.sh
$ ./migrate.py
$ ./app.py
The server starts by default on localhost:8080
.
To test further changes, you'll probably just want one of the following:
# Run the server
$ ./app.py
# Run migrations
$ ./migrate.py
You can see a test account in a third window with:
$ curl localhost:8080/accounts/1
Finally, you can get a PostgreSQL shell with:
$ bin/attach_db.sh
Migrations are run via yoyo package. You can add new migrations in the migrations
directory with a number.name.sql
filename, and you can run migrations with the ./migrate.py
command.