/flask_blog

flask blog from https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world

Primary LanguagePython

flask_blog

made from https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world

also will be hosted in http://jimchong.pythonanywhere.com/ using venv virtual environment with Python 3.6 and venv

Inside wsgi file

import sys
 The "/home/jimchong" below specifies your home
 directory -- the rest should be the directory you uploaded your Flask
 code to underneath the home directory.  So if you just ran
 "git clone git@github.com/myusername/myproject.git"
 ...or uploaded files to the directory "myproject", then you should
 specify "/home/jimchong/myproject"
path = '/home/jimchong/deploy'
if path not in sys.path:
    sys.path.append(path)
from microblog import app as application

Installed Applications

pip install flask-wtf (web forms)
pip install flask-migrate (db)
pip install flask-sqlalchemy (db)
pip install flask-login
pip install flask-mail (email)
pip install pyjwt (json web token for secure token)
pip install flask-bootstrap (css)
pip install flask-moment (date and time js library)
pip install flask-babel (i18n and L10n)

Flask Shell Commands

  • flask db init
  • flask db migrate -m "create table something"
  • flask db upgrade
Flask translate Commands
  • flask translate --help
  • flask translate init [language] - language should be 2 character abbreviate after this, update the messages.po file
  • flask translate compile - compile the transalation
  • flask translate update - apply translation