-
Notifications
You must be signed in to change notification settings - Fork 0
Project Setup For Development
Here is the overview of the steps to install and run this project locally.
Backend
- Install
Python - Install
NodeJSand pnpm via npm - Install
PostgreSQLviadockerorinstaller - Setup Google Google Cloud Project, Oauth Consent, and get Google API Client ID and Secret
- Set up Amazon S3 Bucket and get Amazon S3 Access Key and Secret
- Setup Django Project, and development environment
Frontend
- Run
pnpmto install dependencies in /frontend
pnpm install- Start React app
pnpm devIf you've already installed Pythonand NodeJS, you can skip to Install PostgreSQL
-
Download Python installer and follow the guide on Python website
-
Check Python installation
python --version
You can follow these methods
Then install pnpm, look at this guide or run
npm install -g pnpm-
First of all download and install docker desktop that contains the docker engine, docker CLI, etc.
-
Pull docker
postgresImage
docker pull postgres- Create a Docker container for PostgreSQL. Adjust these variables in the command below
YOUR_CONTAINER_NAMEYOUR_POSTGRE_USERNAMEYOUR_POSTGRE_PASSWORD
docker run --name YOUR_CONTAINER_NAME -e POSTGRES_USER=YOUR_POSTGRE_USERNAME -e POSTGRES_PASSWORD=YOUR_POSTGRE_PASSWORD -p 5432:5432 -d postgres- Wait for the container to start. You can check the logs with
docker logs YOUR_CONTAINER_NAMEExtra: you can download pgadmin4 via docker which is a tool for managing Postgres database. Click here For more information
Host: localhost
Port: 5432 (or the port you specified)
Database: postgres
Database User: YOUR_POSTGRE_USERNAME
Password: YOUR_POSTGRE_PASSWORD
We recommend to install postgres with pgadmin4
After installing of postgres and pgadmin4 you must
- Create a new database.
- Specify username, password, and host as you desire.
Usually, Hostname will be localhost, the port will be 5432, and the default postgres database user is postgres
You can visit here for more information
Here is the overview
- Create Google cloud project
- Setup OAuth Consent
- You need to provide these scopes below in Page Usage Agreements of your Google Cloud Project
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/calendar.acls.readonly
https://www.googleapis.com/auth/calendar.events.readonly
- In Credentials tab, you will see
OAuth 2.0 Client IDs, look for Client ID and Secret their and keep it secret from others.
If you're still confusing about Credentials creation for Client ID, please visit here.
Please follow instruction in Amazon S3 Website
- Clone this repository
git clone https://github.com/Sosokker/Inventory-Management-System
cd Inventory-Management-System- Create virtual environment and use it to install require packages
python -m venv venv(Optional: You can use venv instead)Install virtualenv via pip
python -m pip install --user virtualenv
python -m virtualenv venv# Access virtual environment using
# Windows
.\venv\Scripts\activate
# Linux or MacOS
source venv/bin/activate- Install require module.
pip install -r requirements.txt
- Create file
.envto provide environment varible for Django You can look atsample.envfor more information and others environment variables to set.
SECRET_KEY=your_secret_key
DEBUG=False
ALLOWED_HOSTS=*.ku.th, localhost, 127.0.0.1, ::1
DB_NAME=your_DB_NAME
DB_USER=your_DB_USER
DB_PASSWORD=your_DB_PASSWORD
DB_HOST=your_DB_HOST
DB_PORT=your_DB_PORT
GOOGLE_CLIENT_ID=your_GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET=your_GOOGLE_CLIENT_SECRET
BUCKET_NAME=your_BUCKET_NAME
AMAZON_S3_ACCESS_KEY=YOUR_S3_ACCESS_KEY
AMAZON_S3_SECRET_ACCESS_KEY=YOUR_S3_SECRETGenerate Secret key from Djecrety
Don't forget to change your_secret_key to your secret key (without quote)
- Migrate database then runserver
python manage.py migrate
python manage.py createcachetable {DB_NAME}_cache // DB_NAME is same same as name of your created database
python manage.py runserverYou can now access webpage via http://127.0.0.1:8000/ or you can change port by
python manage.py runserver <PORT>You can navigate through this wiki with a sidebar on the right😉