Welcome to the Training Point Management Web API repository! This project is designed to provide a comprehensive backend solution for managing and tracking training points for students. Developed using Django, this Web API offers a robust framework for handling user authentication, data management, and real-time interactions with the frontend application, which is built using React Native.
- Clone the project
git clone https://github.com/HiepThanhTran/TPM-API.git
cd TPM-API
- Create venv for this project
python3 -m venv .venv
source .venv/bin/activate
- Download packages in requirements.txt file
pip install -r requirements.txt
-
Environment Variables
- Create a .env file in the root directory and add the following:
CLOUDINARY_API_KEY=your-cloudinary-api-key
CLOUDINARY_API_SECRET=your-cloudinary-api-secret
CLOUDINARY_CLOUD_NAME=your-cloudinary-cloud-name
POSTGRES_DATABASE=your-postgres-database
POSTGRES_HOST=your-postgres-host
POSTGRES_PASSWORD=your-postgres-password
POSTGRES_PRISMA_URL=your-postgres-prisma-url
POSTGRES_URL=your-postgres-url
POSTGRES_URL_NON_POOLING=your-postgres-url-non-pooling
POSTGRES_URL_NO_SSL=your-postgres-url-no-ssl
POSTGRES_USER=your-postgres-user
SECRET_KEY=your-postgres-secret-key
-
Create mysql database in your computer or use your database
-
Change name, user, password of DATABASES variable in core/settings.py
-
Run makemigrations and migrate
python3 manage.py makemigrations
python3 manage.py migrate
- Run a data collection if you want sample data (This may take a while)
python3 manage.py collectdata
-
This command will create a superuser with:
- username: [email protected]
- password: admin@123
-
Note: Create superuser if you don't run collectdata command
python3 manage.py createsuperuser
- Run project
python3 manage.py runserver
- Go to admin page to view data