THis is the instructions for assign2, including db config, and flask run.
- Before all running commands, update database in if necessary. First, use
flask shell
Attention : need to be in frontend or memcache folder for flask need to find an app to run this command.
-
Rebuild table
from app import dbdb.drop_all()db.create_all() -
Before connecting to database, add a password.py file in "/database" containing a variable password that is a string of your database password.
password = "yourpassword"
Here replace "yourpassword" with your own password of MySQL.
-
(Optional) Install virtual environment.
python3 -m venv venv -
(Optional) Activate virtual environment.
source venv/bin/activateif wanna quit, use deactivate
-
Install dependencies.
pip3 install -r requirements.txt -
Start Flask app. Now simply use one shell script.
sh run.shif system is Ubuntu, use
./run.sh*The other way is to run each flask instance separately.
FLASK_APP=run.pyDB_HOST=localhost:hostnumber flask --debug run --port <portnumber>Frontend port number is 5000, DB is 3306, autoscaler is 5020, memcache 5001-5008 and manager app is 8001.