- Create python virtual environment
python3 -m venv venv
- Activate the virtual environment Window
\venv\Scripts\activate.bat
MacOS/Linux
. venv/bin/activate
- Install dependencies: change directory to fyp-website
pip install -r requirements.txt
3.1 Create .env
file, copy and paste these lines into file
SECRET_KEY=simplesecret
DEBUG=True
DATABASE_URL=mysql://root:<password>@localhost:3306/fyp
Remember to populate the records of the sql
file in the database
directory
python main.py
See the page on http://127.0.0.1:8000
Before committing, please make the new branch.
Demo image:
delete folder migrations (delete all the existing fyp schema)
# for Windows users
$env:FLASK_APP = "main.py"
# for MAC-OS
export FLASK_APP=main.py
flask db init
OR
python -m flask db init
Instead of each time we create new class in the webapp -> models folder, can use Flask-Migration
flask db migrate -m "adding message"
OR
python -m flask db migrate -m "adding message"
To create migration files, the run
flask db upgrade
OR
python -m flask db upgrade
to apply into database.
Then run:
python insert_book.py
python insert_book_v2.py
python insert_book_v3.py
python insert_reviews.py
python insert_new_arrivals.py
python insert_user.py
python loader.py
Install Elasticsearch and run:
python loader.py