Lab Project for NTU CZ2006 - Software Engineering
This is a very simplified guide on setting up local environment for Windows
Pre-requisite:
- Installed
python3
- Installed
pip
- Go to a folder where you want the repository to be in
- Clone the repository
git clone https://github.com/adriangohjw/cz2006-software-engineering.git
PostgreSQL is the relational DBMS of choice in this project
- Download and install PostgreSQL from Windows installers
- Use the following credentials during the installation (otherwise you can update the Config file):
- Username =
postgres
and password =localhostdbpassword
- Username =
- Open the psql command-line tool by
- In the Windows CMD, run the command:
psql -U postgres
- Enter password when prompted
- Run the command:
create database "cz2006";
- In the Windows CMD, run the command:
Reference: Set Up a PostgreSQL Database on Windows
In Windows CMD, ensure you are in the folder of your repository
- Run
python –m venv venv
- Run
venv\Scripts\activate
- Run
pip install -r requirements.txt
All required packages should have been installed!
venv\Scripts\activate
is also the command to enter your virtual environment whenever you want to run the application on CMD
In Windows CMD, ensure you are in the folder of your repository
- Run
python manage.py db init
- Run
python manage.py db migrate
- Run
python manage.py db upgrade
If you face error, delete the folder "migrations" and try the above steps again.
python run.py
python db_populate\db_populate.py
- WARNING: It will wipe the entire local test DB clean, before populating it with mock data
- To populate in local actual DB, replace
from run_test import create_app
withfrom run import create_app
, save the file and execute the same command
python tests.py
- In console #1, run your local server using
python run_test.py
- In console #2, start locust server using
locust --host=http://localhost:5000
- Open web browser and go to
http://localhost:8089/
- Enter
number of users
andhatch rate
(e.g. 100, 10) - Start load testing by clicking
Start swarming