Skip to content

fan9704/PetMonitoringSystem-Backend

Repository files navigation

Pet Monitoring Backend

System Structure

Software Development Lifecycle


Swagger Route

Django System Check

Rabbit Console

SonarQube Console

Forest Admin

Setup Project

Step.1 Install Dependencies with pipenv

pipenv install

Step.2 Construct Environments with Docker-compose

docker-compose up

Step.3 Environment Variables .env Setup

.env file Please refer .env.example

#Django
DJANGO_SECRET_KEY =
DEBUG =
#Elasticsearch
ELASTICSEARCH_ENDPOINT = 
#PostgreSQL
POSTGRES_DB =
POSTGRES_USER =
POSTGRES_PASSWORD =
POSTGRES_DB_URL =
#ChatGPT
CHATGPT_APIKEY = 
#RabbitMQ
RABBITMQ_ENABLE = 
RABBITMQ_USERNAME = 
RABBITMQ_PASSWORD = 
RABBITMQ_SERVER_IP = 
RABBITMQ_PORT = 
RABBITMQ_VIRTUAL_HOST = 
#Celery
BROKER_URL =
#Redis
REDIS_URL=
...

Step.4 Migrate Schema to PostgreSQL

pipenv run python manage.py migrate

Step.5 Migrate Index to Elasticsearch(django-elasticsearch-dsl)

pipenv run python manage.py search_index --create
pipenv run python manage.py search_index --populate --refresh

Step.6 Runserver

pipenv run python manage.py runserver 0.0.0.0:8000

Step.7 Run Commands

pipenv run python manage.py MQTTListener

Other

Install Dependencies with venv

Create venv

python -m venv .

Activate venv

Scripts/activate

Deactivate venv

Scripts/deactivate

Install from requirements.txt

pip install -r requirements.txt

Freeze dependencies

pip freeze > requirements.txt

Run Integration Test

python manage.py test PetMonitoringSystemBackend.test [--verbosity 2]# Unit Test --verbosity 2 is output detail
python manage.py test api.tests.unit [--verbosity 2]# Unit Test --verbosity 2 is output detail
python manage.py test api.tests.integration #Intergration Test
python manage.py test  #All Test

Run with ASGI

daphne -b 0.0.0.0 -p 8000 PetMonitoringSystemBackend.asgi:application

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages