Skip to content

vjousse/vim-for-humans-website

Repository files navigation

Installation

First, be sure to sign up for a Stripe account (the payment platform) and go to the API page to get your keys.

In this readme, I'm using 3 sample keys:

PUBLISHABLE_KEY=pk_test_4aZnwTrOtTfNSxs8KtI1a3LC
SECRET_KEY=sk_test_4aZnq9QgKUcJ2cPp9dGaidOT
ENDPOINT_SECRET=whsec_AjrfPgBKPZhCnU5grqtuhDnXU5OYA9zf

Pip / python env

pip install virtualenv
virtualenv -p /usr/bin/python3 env
. ./env/bin/activate
pip install -r requirements.txt

Create db

PUBLISHABLE_KEY=pk_test_4aZnwTrOtTfNSxs8KtI1a3LC SECRET_KEY=sk_test_4aZnq9QgKUcJ2cPp9dGaidOT ENDPOINT_SECRET=whsec_AjrfPgBKPZhCnU5grqtuhDnXU5OYA9zf python
from app import db,app
app.app_context().push()
db.create_all()

You can use to exit the python shell. The database should have been created under the instance/ directory.

Translations

Extract strings to translate

pybabel extract -F babel.cfg -o messages.pot ./templates

Update messages.po

pybabel update -i messages.pot -d translations

Finally compile

pybabel compile -d translations

Run

Depending on the keys, it will run in production/test mode for stripe.

ENDPOINT_SECRET="whsec_AjrfPgBKPZhCnU5grqtuhDnXU5OYA9zf" PUBLISHABLE_KEY=pk_test_4aZnwTrOtTfNSxs8KtI1a3LC SECRET_KEY=sk_test_4aZnq9QgKUcJ2cPp9dGaidOT python app.py

The dev server should be listening on http://localhost:5000

Supervisor

Of course, you need to replace the test keys by the live one.

[program:vimebook]
environment = PATH="/home/vimebook/python/vim-for-humans-website/env/bin:%(ENV_PATH)s",PUBLISHABLE_KEY="pk_test_4aZnwTrOtTfNSxs8KtI1a3LC",SECRET_KEY="sk_test_4aZnq9QgKUcJ2cPp9dGaidOT",ENDPOINT_SECRET="whsec_AjrfPgBKPZhCnU5grqtuhDnXU5OYA9zf"
command = /home/vimebook/python/vim-for-humans-website/gunicorn_start.sh ; Command to start app
user = vimebook ; User to run as
stdout_logfile = /home/vimebook/python/vim-for-humans-website/log/gunicorn_supervisor.log ; Where to write log messages
redirect_stderr = true ; Save stderr in the same log

Supervisorctl commands:

supervisorctl reread
supervisorctl update

Extract parts of the PDF

pdftk vim-pour-les-humains.pdf cat 7-23 output vim-pour-les-humains-extrait.pdf

Good reads

About

Website (python3, Flask, babel, stripe) for the ebook Vim for humans

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published