Constructing a web app to host a weekly pick-em style series of matchup predictions for fantasy football
First: to initialize a database secret key, create a file pickem/DB_SECRET_KEY
that contains the db's secret key on the first line. On initialization, the DB_SECRET_KEY will be setup to have this as the secret key.
The database can be set up in one of two ways:
python
. Then type the following:from pickem import db, create_app, init_schedule
db.create_all(app=create_app())
init_schedule()
This creates all the tables as defined in models.py
; init_schedule()
scrapes the schedule data from ESPN at the start of the season and turns it into a format that is more readable before writing to the games
table (should only be done once total).
pickem/<name_of_db>.db
and manually add the requisite tables in (far larger hassle)
pickem_tables.db
in method 1 so either use the same name or change this in __init.py__
pickem
). Optionally, flip the FLASK_DEBUG
flag if you want debug mode to be on.
export FLASK_APP=pickem
export FLASK_DEBUG=1
flask run
OR
run.py
out of the root directory:
python run.py
By script:
sqlite3 pickem/<old db name> ".dump user" | sqlite3 pickem/<new db name>.db
python backport.py