Skip to content

mikelu94/django

Repository files navigation

Django

Some django projects that I wrote.

Dependencies

  • Docker
  • kubectl
  • minikube
  • Okta Developer Account (Free)

Technologies

  • Python 3
  • Django
  • PostgreSQL
  • Redis
  • RabbitMQ
  • Open ID Connect
  • Logstash

Preliminaries

  1. Create an OIDC application (see instructions).

  2. Run python3 -c 'import secrets; print(secrets.token_urlsafe())' and save the generated secret key.

  3. Create ./.env:

CLIENT_ID=<Client ID here>
CLIENT_SECRET=<Client Secret here>
OKTA_DOMAIN=<Your Okta Domain here>
DJANGO_SECRET_KEY=<Your Secret Key here>
  1. Run create_secrets.sh:
$ ./create_secrets.sh

How to Set Up Development Environment (localhost)

$ docker compose up -d
$ docker exec -it app bash
$ python manage.py migrate

URLs:

  • http://localhost:8000/oidc
  • http://localhost:8000/admin
  • http://localhost:8000/swagger

How to Set Up Production Environment (minikube)

  1. Start minikube:
$ sudo sh -c 'cat /dev/null > /var/db/dhcpd_leases'
$ minikube start --memory=6g --cpus=4 --disk-size=50g --addons=ingress
  1. Build and Publish Image:
$ eval $(minikube -p minikube docker-env)
$ docker build -t app .
  1. Deploy to Production Environment:
$ kubectl apply -R -f kubernetes
  1. Create Tables and Superuser:
$ kubectl exec -it $(kubectl get pod --selector=app=app -o name) -- bash
$ python manage.py migrate
$ python manage.py collectstatic --noinput

URLs:

  • http://192.168.64.2/oidc
  • http://192.168.64.2/admin
  • http://192.168.64.2/swagger

About

django projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published