This is the API for UniLabs Inventory Management System
Make sure you have python 3.6 or newer installed on your computer. If so, clone this repository to your local computer.
$ git clone https://github.com/UniLabsIMS/UniLabs-API.git
$ cd UniLabs-API
Then create a virtual environment to run the project in. The commands may change depending on the operating system you are using. For windows,
$ python -m venv env
$ .\env\Scripts\activate.bat
Then install dependencies needed in the virtual environment
(venv) pip install -r requirements.txt
Check if following command prints the available commands. If the installation is successful, this should not cause an error.
(venv) python manage.py
Install PostgreSQL in the local machine and setup correctly. Use the following command to log in to the psql
shell as postgres
user.
$ psql -U postgres
Then create a new database and exit the psql
shell
(psql) CREATE DATABASE unilabs_API;
(psql) \q
Contact a team member and setup .env file with sensitive information
First, run the database migration and create the necessary tables. Make sure you are in the correct virtual environment. Whenever there is a database model change, you should re-run this.
(env) python manage.py makemigrations
(env) python manage.py migrate
Afterward, try running the API
(env) python manage.py runserver
Activate the virtual environemnt
$ .\env\Scripts\activate.bat
Checkout main and pull changes
(env) git checkout main
(env) git pull
checkut to a new branch
(env) git checkout -b feature/<feature_name>
install missing dependancies and rerun migrations
(env) pip install -r requirements.txt
(env) python manage.py makemigrations
(env) python manage.py migrate
Start and run API
(env) python manage.py runserver