It's a MVT structure to start developing web applications based on Flask. The structure is improved to work with PostgreSQL, but you can also work with any other RDBMS. There's also a simple Blackjack game made with jQuery's ajax functionality to provide an example of how to communicate with the server's routes, just for fun.
To start working with it you must clone this repository and provide a optimal virtualenvironment in order to deploy Flask_Base. It's important to install virtualenvwrapper on your system, it's a great tool to manage virtualenv.
postgresql-11 libpq-dev python3-dev
You must configure a user and a database for your application on PostgreSQL!
After you've installed those system dependencies, you can proceed cloning Flask_Base:
# git clone http://github.com/MarcelFox/flask_base
# cd flask_base/
# mkvirtualenv --python="/usr/bin/python3" -r requirements.txt venv_name
This flask base structure uses environment variables which works very well with virtualenvwrapper. At this point we have to set up only two variables:
SECRET_KEY
DATABASE_URL
$HOME/.virtualenvs/venv_name/bin/postactivate:
export FLASK_APP='$HOME/flask_base/run.py'
export SECRET_KEY='Shrubbery'
export DATABASE_URL='postgresql://USER:PASS@localhost/DATABASE'
$HOME/.virtualenvs/venv_name/bin/postdeactivate:
unset FLASK_APP
unset SECRET_KEY
unset DATABASE_URL
(venv)$ uwsgi --ini="uwsgi.ini"
Now your application will be accessible on: