Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.21 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.21 KB

Money Transfer (Python)

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.

Getting Started

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

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.