This is a term project for CMPT 339 at Trinity Western University
- Clone the repository locally
- Run
python -m venv venv - Run
venv/Scripts/activateif on Windows - Run
pip install -r requirements.txt
- Create a new database in MySQL Workbench called
stoodle - Apply
sql/db_init.sqlto the database (Or run a database rebuild later (see below))
Optional:
3) Create a new user with CREATE USER '[USERNAME]'@'localhost' IDENTIFIED BY '[PASSWORD]';
4) Give this user access to the database with GRANT ALL PRIVILEGES ON stoodle.* TO '[USERNAME]'@'localhost';
Create config.py in the root folder with the following contents
# Database Connection
MYSQL_HOST = 'localhost'
MYSQL_DB = 'stoodle'
MYSQL_USER = '[USERNAME]'
MYSQL_PASSWORD = '[PASSWORD]'
SECRET_KEY = '[SECRET_KEY]'
UPLOAD_FOLDER = r'[Full path to file folder]'
USERNAME and PASSWORD are those used when setting up a database
SECRET_KEY is any sequence of characters and can be generated with python -c 'import secrets; print(secrets.token_hex())'
UPLOAD_FOLDER is where you would like uploaded files to be stored. A folder named file_uploads in the project root is recommended.
- Run
flask runto test the website locally. (Optionally add--debugfor hot reloading)
Since this is active development, the database schema is changing frequently. The easiest way to keep up to date with this is to ensure sql/init_db.sql has the proper sql commands to setup the database and then use the rebuild_db.py script:
- Run
cd sql - Run
python rebuild_db.py