Skip to content

mikelu94/django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 24, 2023
9f72134 · Jun 24, 2023

History

30 Commits
Oct 1, 2021
Oct 1, 2021
Apr 11, 2022
Dec 10, 2022
Oct 1, 2021
Apr 10, 2022
Jan 15, 2023
Oct 1, 2021
Jan 10, 2021
Apr 10, 2022
Feb 22, 2022
Dec 10, 2022
Dec 10, 2022
May 20, 2022
Apr 11, 2022
Jun 24, 2023

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