Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vjousse/vim-for-humans-website
Website (python3, Flask, babel, stripe) for the ebook Vim for humans
https://github.com/vjousse/vim-for-humans-website
ebook flask vim
Last synced: about 1 month ago
JSON representation
Website (python3, Flask, babel, stripe) for the ebook Vim for humans
- Host: GitHub
- URL: https://github.com/vjousse/vim-for-humans-website
- Owner: vjousse
- License: mit
- Created: 2015-08-13T07:55:11.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-07-10T15:10:08.000Z (6 months ago)
- Last Synced: 2024-10-22T01:34:55.691Z (2 months ago)
- Topics: ebook, flask, vim
- Language: CSS
- Homepage: https://vimebook.com
- Size: 43.4 MB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Installation
First, be sure to sign up for a [Stripe account](https://stripe.com/) (the payment platform) and go to the [API page](https://dashboard.stripe.com/account/apikeys) 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 logSupervisorctl 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
- https://eff.iciently.com/blog/stripe_checkout.html
- http://www.jeffknupp.com/blog/2014/01/18/python-and-flask-are-ridiculously-powerful/
- http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiv-i18n-and-l10n
- https://www.safaribooksonline.com/blog/2013/11/27/flask-internationalization-and-localization/
- http://damyanon.net/