A very simple landing page using flask and sqlite
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
apache
static
templates
translations/de/LC_MESSAGES
.gitignore
README.md
apache_conf.wsgi
babel.cfg
backup-to-amazon
config.py
landing.py
messages.pot
model.py
refresh_translations.sh
requirements.txt
run.sh
view_database.sh

README.md

Flask Landing page

A very lightweight landing page with email signup and i18n. It uses Python Flask and sqlite.

This project was originally created for hellobudget.co

Setup

  1. Install packages sudo apt install python-pip python-virtualenv python-dev
  2. Create a python virtual environment: virtualenv venv
  3. Enter virtual environment: . venv/bin/activate
  4. Install python packages pip install -r requirements.txt
  5. Initialize database: export FLASK_APP=landing.py && flask initdb
  6. Run app in debug mode locally using run.sh

Also See here: http://flask.pocoo.org/docs/0.11/installation/#installation Leave virtual environment with $ deactivate

Translate

To initialise, do this:

  1. Extract texts: pybabel extract --project landing-page --version 1 -F babel.cfg -o messages.pot .
  2. Init German translation (only run this once): pybabel init -i messages.pot -d translations -l de

If texts in source language have been changed or added:

  1. pybabel extract --project landing-page --version 1 -F babel.cfg -o messages.pot .
  2. Do translations
  3. Continue as below

If translations have been changed:

  1. Update pybabel update -i messages.pot -d translations
  2. Compile: pybabel compile -d translations

Installing a new package via pip

  1. Install: pip install peewee
  2. Save to requirements pip freeze > requirements.txt

Production Notes for Apache

  • Here's a good tutorial.
  • Check Apache error log if you see a 500 error
  • Make sure the following files and directories are universally writable. They will need be written to by the www-data user
    • signups.db
    • /static/.webassets-cache/
    • /static/gen