____ _ __ __ _ _
/ ___| _ ___| |_ ___ _ __ ___ \ \ / /__ _ __| | _____ _ _| |_
| | | | | / __| __/ _ \| '_ ` _ \ \ \ /\ / / _ \| '__| |/ / _ \| | | | __|
| |__| |_| \__ \ || (_) | | | | | | \ V V / (_) | | | < (_) | |_| | |_
\____\__,_|___/\__\___/|_| |_| |_| ___\_/\_/ \___/|_| |_|\_\___/ \__,_|\__|
| _ \| | __ _ _ _| (_)___| |_ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __
| |_) | |/ _` | | | | | / __| __| | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__|
| __/| | (_| | |_| | | \__ \ |_ | |_| | __/ | | | __/ | | (_| | || (_) | |
|_| |_|\__,_|\__, |_|_|___/\__| \____|\___|_| |_|\___|_| \__,_|\__\___/|_|
|___/
- Student 1. Iresh Jayasundara - Iresh.JayasundaraMudiyanselage@student.oulu.fi
- Student 2. Kavindu Wijesinghe - Kavindu.WijesingheArachchilage@student.oulu.fi
- Student 3. Sonali Prasadika - Sonali.LiyanaBadalge@student.oulu.fi
- Student 4. Nirasha Thennakoon - Nirasha.KaluarachchiThennakoonAppuhamilage@student.oulu.fi
The following chapter describes the the selection of databases, libraries and instructions to setup the requirements needed for the Custom Workout Playlist Generator.
Following tools and libraries are required for setting up the database for the Custom Workout Playlist Generator. Note that the steps in this section listed below is designed as a guide for you to manually setup the database. If you wish to skip these steps and directly create the database, tables and dummy data, jump to the installing MySql step and follow the next section titled Flask app setup.
- Install latest python version from here. 3.11.5 is recommended
- Install pip from here. 23.2.1 is recommended. Note: pip will be available as a part of your python installation. you can check the pip version for verifying.
pip --versionFlask is a web application framework written in Python. Read more abput flask from here. Install flask 2.2.2 using the following command.
pip install flaskThe Flask SQL Alchemy SQL Toolkit and Object Relational Mapper is a comprehensive set of tools for working with databases and Python. It has several distinct areas of functionality which can be used individually or combined together. Its major components are illustrated below, with component dependencies organized into layers: Read more here
- Install FlaskSQLAlchemy. Use pip to install or refer here for other methods of installation.
pip install flask-sqlalchemy sqlalchemyMysqlclient is an interface to the MySQL database server that provides the Python database API.
pip install mysqlclientSwagger allows to describe the structure of the APIs so that machines can read them.
pip install flasggerMySQL was chosen as a database for the project because it's free to use, widely used, and performs well with large amounts of data. It's easy to scale up as projects grow and works with many programming languages. Plus, it's secure and stable, making it a reliable option for important tasks.
- install MySQL communuty edition from here
- When prompted for the credentials duting the installation wizard, use the username root and password root. if you wish to use a different credentials, make sure to update the modified credentials when runng the app.py in the next section.
- Configre the MySQL server to run on your OS with your credentials.
- ☑️ blinker==1.7.0
- ☑️ click==8.1.7
- ☑️ colorama==0.4.6
- ☑️ Flask==3.0.2
- ☑️ Flask-SQLAlchemy==3.1.1
- ☑️ greenlet==3.0.3
- ☑️ itsdangerous==2.1.2
- ☑️ Jinja2==3.1.3
- ☑️ MarkupSafe==2.1.5
- ☑️ mysqlclient==2.2.3
- ☑️ python-dateutil==2.8.2
- ☑️ pytz==2023.3.post1
- ☑️ six==1.16.0
- ☑️ SQLAlchemy==2.0.25
- ☑️ typing_extensions==4.9.0
- ☑️ tzdata==2023.4
- ☑️ Werkzeug==3.0.1
- ☑️ flask-jwt-extended==4.6.0
- ☑️ pytest=8.1.1
- ☑️ flasgger==0.9.5
#Flask App and Environment Setup
If you have skipped the manual setup to install the required libraries, you can use the ❎❎requirements.txt❎❎ file to install the nessacery libraries.
- We recommend you use a Python Virtual Environment for setting-up the next steps.
- Create a folder of your choosing for the virtual Environment
- Clone our repo to the folder
- Use the folder path to create the Virtual Environment
python3 -m venv /path/to/the/virtualenv- Activate the Virtual Environment
c:\path\to\the\virtualenv\Scripts\activate.bat
on OSX
source /path/to/the/virtualenv/bin/activatepip install -r requirements.txt- Run the flask App. this will create all the tables and relationships in your environment. make sure to change the password install to the database url if you have used a password of your own.
app.config["SQLALCHEMY_DATABASE_BASE_URI"] = "mysql+mysqldb://root@localhost/"python __init__.py- To add sample data to the tables, you can run the provided sql dump using the following command.
use workout_playlists
source /path/to/sql/your_sql_file.sqlTo run all test cases
Run “pytest” cmd in project folderTo run specific test class
– Run pytest <path to test folder>/<testclassname>.pyhttp://localhost:5000/apidocs/