forked from 3wordchant/capsul-flask
		
	fix bugs and update readme with pipenv run
This commit is contained in:
		
							
								
								
									
										22
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								README.md
									
									
									
									
									
								
							| @ -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: | ||||
|  | ||||
|  | ||||
|  | ||||
| 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----- | ||||
|  | ||||
| @ -98,7 +98,7 @@ def cron_task(): | ||||
|         active=balance_1w  < 0, | ||||
|         subject="Capsul One Week Payment Reminder", | ||||
|         body=("According to our calculations, your Capsul account will run out of funds in one week.\n\n" | ||||
|               f"Log in now to re-fill your account! {current_app.config["BASE_URL"]}/console/account-balance\n\n" | ||||
|               f"Log in now to re-fill your account! {current_app.config['BASE_URL']}/console/account-balance\n\n" | ||||
|               "If you believe you have recieved this message in error, please let us know: support@cyberia.club") | ||||
|       ), | ||||
|       dict( | ||||
| @ -106,7 +106,7 @@ def cron_task(): | ||||
|         active=balance_1d  < 0, | ||||
|         subject="Capsul One Day Payment Reminder", | ||||
|         body=("According to our calculations, your Capsul account will run out of funds tomorrow.\n\n" | ||||
|               f"Log in now to re-fill your account! {current_app.config["BASE_URL"]}/console/account-balance\n\n" | ||||
|               f"Log in now to re-fill your account! {current_app.config['BASE_URL']}/console/account-balance\n\n" | ||||
|               "If you believe you have recieved this message in error, please let us know: support@cyberia.club") | ||||
|       ), | ||||
|       dict( | ||||
| @ -116,7 +116,7 @@ def cron_task(): | ||||
|         body=(f"You have run out of funds! You will no longer be able to create Capsul{pluralize_capsul}.\n\n" | ||||
|               f"As a courtesy, we'll let your existing Capsul{pluralize_capsul} keep running until your account " | ||||
|               "reaches a -$10 balance, at which point they will be deleted.\n\n" | ||||
|               f"Log in now to re-fill your account! {current_app.config["BASE_URL"]}/console/account-balance\n\n" | ||||
|               f"Log in now to re-fill your account! {current_app.config['BASE_URL']}/console/account-balance\n\n" | ||||
|               f"If you need help decomissioning your Capsul{pluralize_capsul}, " | ||||
|                "would like to request backups, or de-activate your account, please contact: support@cyberia.club") | ||||
|       ), | ||||
| @ -126,9 +126,9 @@ def cron_task(): | ||||
|         subject=f"Your Capsul{pluralize_capsul} Will be Deleted In Less Than a Week", | ||||
|         body=("You have run out of funds and have not refilled your account.\n\n" | ||||
|               f"As a courtesy, we have let your existing Capsul{pluralize_capsul} keep running. " | ||||
|               f"However, your account will reach a -$10 balance some time next week and your Capsul{pluralize_capsul}"" | ||||
|               f"However, your account will reach a -$10 balance some time next week and your Capsul{pluralize_capsul}" | ||||
|               "will be deleted.\n\n" | ||||
|               f"Log in now to re-fill your account! {current_app.config["BASE_URL"]}/console/account-balance\n\n" | ||||
|               f"Log in now to re-fill your account! {current_app.config['BASE_URL']}/console/account-balance\n\n" | ||||
|               f"If you need help decomissioning your Capsul{pluralize_capsul}, " | ||||
|                "would like to request backups, or de-activate your account, please contact: support@cyberia.club")  | ||||
|       ), | ||||
| @ -139,7 +139,7 @@ def cron_task(): | ||||
|         body=("You have run out of funds and have not refilled your account.\n\n" | ||||
|               f"As a courtesy, we have let your existing Capsul{pluralize_capsul} keep running. " | ||||
|               f"However, your account will reach a -$10 balance tomorrow and your Capsul{pluralize_capsul} will be deleted.\n\n" | ||||
|               f"Last chance to deposit funds now and keep your Capsul{pluralize_capsul} running! {current_app.config["BASE_URL"]}/console/account-balance")  | ||||
|               f"Last chance to deposit funds now and keep your Capsul{pluralize_capsul} running! {current_app.config['BASE_URL']}/console/account-balance")  | ||||
|       ), | ||||
|       dict( | ||||
|         id='delete_now', | ||||
|  | ||||
		Reference in New Issue
	
	Block a user