Giter Site home page Giter Site logo

django-two-admin-template's Introduction

Django Boiler Plate for Two-Factor Admin Site

You can easily create django project which requires two or multi admin sites.

Setup

$ python -m venv venv
$ source venv/bin/activate
$ pip3 install -r requirements.txt

Features

Two Admin Site

In admin_site.sites package, there exist two admin site modules (site_superuser.py and site_teacher.py).

  1. site_superuser

This is an original admin site object, but only superuser can log-in with / enter this site. (user.is_superuser == True) You can add extra conditions to this superuser-only admin site.

  1. site_teacher

This is an admin site object constructed from new class, which makes superuser unable to log-in with this site. Staffs (user.is_superuser == False but user.is_staff == True) can log-in with this site.

Separated settings file

  1. Local (Dev) Environment

In Windows or MacOS, django will serve for default debug settings automatically:

$ python manage.py runserver
  1. Production Environment

In Linux, wsgi will serve with production settings, depending on the secret.json file.

secret.json file should contain ALLOWED_HOSTS, SECRET_KEY, and DATABASES information like below:

{
  "ALLOWED_HOSTS": [
    "your host ip or domains"
  ],
  "SECRET_KEY" : "production secret key",
  "DATABASES": {
    "default": {
      "ENGINE": "django.db.backends.mysql",
      "NAME": "production database name",
      "USER": "production database user",
      "PASSWORD": "production database password",
      "HOST": "production database host",
      "PORT": "3306"
    }
  }
}

After configuring secret.json, run gunicorn with config.wsgi:application and have fun~

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.