Giter Club home page Giter Club logo

django-whitelabel's Introduction

Django whitelabel

Features

  • Separated settings for different environments
  • Docker
  • Different docker-compose for different environments
  • CI/CD

Environments

  • Local dev: to develop on your PC without Docker. Use manage.py as always.
  • Docker dev: to develop on your PC using a more production-like environment with a MySQL database. Auto-reload is enabled and every change in the app folder is applied to /app in the container and vice versa. Requirements are installed at build time and migrations are applied at boot but you can do that manually.
  • Staging: like production but with admin and debug enabled for testing purposes.
  • Production: the deployed version.

How to use Docker dev

  1. create a file named .env containing the required environment variables (read the next section)
  2. run docker-compose up --build
  3. work with your local files
  4. execute commands inside the container. ex docker exec -it django-whitelabel-app_1 python manage.py makemigrations

Features table

Local Dev Docker Dev Staging Production
Auto-reload
Auto migrate at start
Auto requirements install at start
Database SQLite MariaDB MariaDB MariaDB
Database port publically exposed Not present
Reverse proxy (Nginx)
Debug
Admin page ❌ (can be enabled in settings/production)
Serving media automatically
CORS allow all
CSRF allow all
Allow all hosts

Configuration

Required environment variables

  • ✅ Required
  • ❌ Not required
  • ⚠️ Optional
Local Dev Docker Dev Staging Production
MYSQL_PASSWORD
SECRET_KEY (default string for dev) ⚠️ ⚠️
ALLOWED_HOSTS (all for dev)
CORS_ALLOWED_ORIGINS (all for dev)
CSRF_TRUSTED_ORIGINS (all for dev)
EMAIL_HOST ⚠️ ⚠️ ⚠️ ⚠️
EMAIL_HOST_PASSWORD ⚠️ ⚠️ ⚠️ ⚠️
EMAIL_HOST_USER ⚠️ ⚠️ ⚠️ ⚠️
EMAIL_PORT (default EMAIL_PORT) ⚠️ ⚠️ ⚠️ ⚠️

Example .env

MYSQL_PASSWORD=somerandomstring
SECRET_KEY=anotherrandomstring
EMAIL_HOST=smtp.gmail.com
EMAIL_HOST_PASSWORD=gmailpassword
[email protected]
EMAIL_PORT=587
ALLOWED_HOSTS=localhost,127.0.0.1,api.something.it
CORS_ALLOWED_ORIGINS=https://frontend.com,https://sub.frontend.com
CSRF_TRUSTED_ORIGINS=https://api.app.com,https://app.com,https://*.otherdomain.com

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.