Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agn-7/bitpin-project
A Django project to rate a content model through REST APIs
https://github.com/agn-7/bitpin-project
django django-rest-framework docker docker-compose kubernetes nginx pytest python
Last synced: about 1 month ago
JSON representation
A Django project to rate a content model through REST APIs
- Host: GitHub
- URL: https://github.com/agn-7/bitpin-project
- Owner: agn-7
- Created: 2022-04-18T13:13:56.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-13T17:32:08.000Z (over 1 year ago)
- Last Synced: 2024-11-16T00:36:01.258Z (3 months ago)
- Topics: django, django-rest-framework, docker, docker-compose, kubernetes, nginx, pytest, python
- Language: Python
- Homepage:
- Size: 2.75 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://https://docker.com/)
[](https://github.com/agn-7/bitpin-project/actions/workflows/github-actions.yml)
[](https://codecov.io/gh/agn-7/bitpin-project)
[](https://github.com/ambv/black)
# bitpin-project
## Django + Docker + Postgresql + DRF + pytest + Kubernetes
### Running
Normally you can run the project in development mode:
```bash
cd bitpin
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver 0.0.0.0:8000
```The project can also be run in production mode using docker compose:
```bash
docker-compose up -d --build
docker exec -it bitpin_app python manage.py createsuperuser --settings=bitpin.production_settings
```Or via Kubernetes (microk8s):
```bash
docker compose build
docker run -d -p 5000:5000 --restart=unless-stopped --name registry registry:2
docker tag bitpin:1.0.0 localhost:5000/bitpin:1.0.0
docker tag nginx:alpine localhost:5000/nginx:alpine
docker push localhost:5000/bitpin:1.0.0
docker push localhost:5000/nginx:alpinemkdir manifests
find k8s/ -name "*.yml" | xargs -I{} cp {} manifests/
microk8s enable dns storage
microk8s kubectl apply -f manifests
microk8s kubectl get allmicrok8s kubectl get pods --show-labels
microk8s kubectl label pods bitpin-nginx app=bitpin-nginx
microk8s kubectl exec -it bash
python manage.py createsuperuser --settings=bitpin.production_settingsmicrok8s kubectl port-forward service/bitpin-nginx-service 8080:80
```Then it's time to go to the `/admin` and create some content instances. Next, check them all and/or rate them using the following endpoints:
Endpoint |HTTP Method | CRUD Method | Result
-- | -- |-- |--
`api/v1/content/` | GET | READ | Get all contents
`api/v1/rate/:content_id/` | POST | CREATE | Create a new vote
`api/v1/rate/`| POST | CREATE | Create a new vote
`api-token-auth/` | POST | READ | Get a token