fix bugs and update readme with pipenv run

This commit is contained in:
2020-05-14 23:54:08 -05:00
parent d1078b8f30
commit 8e8705da7b
2 changed files with 16 additions and 18 deletions

View File

@ -23,8 +23,6 @@ Create python virtual environment and install packages
```
# install deps
pipenv install
# load the deps into $PATH
pipenv shell
```
Run an instance of Postgres (I used docker for this, you can use whatever you want, point is its listening on localhost:5432)
@ -42,12 +40,12 @@ nano capsulflask/__init__.py
Run the app
```
flask run
pipenv run flask run
```
Run the app in gunicorn
```
.venv/bin/gunicorn --bind 127.0.0.1:5000 capsulflask:app
pipenv run gunicorn --bind 127.0.0.1:5000 app:app
```
-----
@ -57,29 +55,29 @@ Run the app in gunicorn
You can manually mess around with the database like this:
```
flask cli sql -f test.sql
pipenv run flask cli sql -f test.sql
```
```
flask cli sql -c 'SELECT * FROM vms'
pipenv run flask cli sql -c 'SELECT * FROM vms'
```
This one selects the vms table with the column name header:
```
flask cli sql -c "SELECT string_agg(column_name::text, ', ') from information_schema.columns WHERE table_name='vms'; SELECT * from vms"
pipenv run flask cli sql -c "SELECT string_agg(column_name::text, ', ') from information_schema.columns WHERE table_name='vms'; SELECT * from vms"
```
How to modify a payment manually, like if you get a chargeback or to fix customer payment issues:
```
$ flask cli sql -c "SELECT id, created, email, dollars, invalidated from payments"
$ pipenv run flask cli sql -c "SELECT id, created, email, dollars, invalidated from payments"
1, 2020-05-05T00:00:00, forest.n.johnson@gmail.com, 20.00, FALSE
$ flask cli sql -c "UPDATE payments SET invalidated = True WHERE id = 1"
$ pipenv run flask cli sql -c "UPDATE payments SET invalidated = True WHERE id = 1"
1 rows affected.
$ flask cli sql -c "SELECT id, created, email, dollars, invalidated from payments"
$ pipenv run flask cli sql -c "SELECT id, created, email, dollars, invalidated from payments"
1, 2020-05-05T00:00:00, forest.n.johnson@gmail.com, 20.00, TRUE
```
@ -87,7 +85,7 @@ $ flask cli sql -c "SELECT id, created, email, dollars, invalidated from payment
How you would kick off the scheduled task:
```
flask cli cron-task
pipenv run flask cli cron-task
```
-----
@ -152,7 +150,7 @@ And you should see the token in the btcpay server UI:
![](readme/paired.jpg)
Now simply set your BTCPAY_PRIVATE_KEY private key in `.env`
Now simply set your `BTCPAY_PRIVATE_KEY` variable in `.env`
```
BTCPAY_PRIVATE_KEY='-----BEGIN EC PRIVATE KEY-----