|
| 1 | +# [Django Material Dash2 PRO](https://appseed.us/product/material-dashboard2-pro/django/) |
| 2 | + |
| 3 | +**Django** starter styled with **[Material Dashboard PRO](https://appseed.us/product/material-dashboard2-pro/django/)**, a premium `Bootstrap 5` KIT from `Creative-Tim` |
| 4 | +The product is designed to deliver the best possible user experience with highly customizable feature-rich pages. |
| 5 | + |
| 6 | +- 🛒 [Django Material Dash 2 PRO](https://appseed.us/product/material-dashboard2-pro/django/) - `Product page` |
| 7 | +- 👉 [Django Material Dash 2 PRO](https://django-mat-dash2-enh-latest.onrender.com/) - `LIVE Demo` |
| 8 | + |
| 9 | +<br /> |
| 10 | + |
| 11 | +## Features |
| 12 | + |
| 13 | +- `Up-to-date dependencies` |
| 14 | +- Database: `SQLite`, PgSQL, MySql |
| 15 | +- **Authentication** |
| 16 | + - `Session-Based authentication` |
| 17 | + - `Social Login`: **Github** & **Google** |
| 18 | +- **User Extended profile** |
| 19 | +- **API** via DRF |
| 20 | +- DataTables |
| 21 | +- Charts |
| 22 | +- Celery |
| 23 | +- File Manager |
| 24 | +- i18n (internationalization) |
| 25 | +- `Docker` |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +<br /> |
| 30 | + |
| 31 | +## Start in `Docker` |
| 32 | + |
| 33 | +> **Step 1** - Download the [code](https://appseed.us/product/material-dashboard2-pro/django/) and unzip the sources (requires a `purchase`). |
| 34 | +
|
| 35 | +```bash |
| 36 | +$ unzip django-material-dashboard2-enh.zip |
| 37 | +$ cd django-material-dashboard2-enh |
| 38 | +``` |
| 39 | + |
| 40 | +<br /> |
| 41 | + |
| 42 | +> **Step 2** - Start the APP in `Docker` |
| 43 | +
|
| 44 | +```bash |
| 45 | +# Optional (kill all existing containers) |
| 46 | +$ docker container kill $(docker ps -q) ; docker container rm $(docker ps -a -q) ; docker network prune -f |
| 47 | +# Start the APP |
| 48 | +$ docker-compose up --build |
| 49 | +``` |
| 50 | + |
| 51 | +Visit `http://localhost:5085` in your browser. The app should be up & running. |
| 52 | + |
| 53 | +<br /> |
| 54 | + |
| 55 | +## Create new `.env` from `env.sample` |
| 56 | + |
| 57 | +The meaning of each variable can be found below: |
| 58 | + |
| 59 | +- `DEBUG`: if `True` the app runs in develoment mode |
| 60 | + - For production value `False` should be used |
| 61 | +- `MYSQL` credentials |
| 62 | + - `DB_ENGINE`, default value = `mysql` |
| 63 | + - `DB_NAME`, default value = `appseed_db` |
| 64 | + - `DB_HOST`, default value = `localhost` |
| 65 | + - `DB_PORT`, default value = `3306` |
| 66 | + - `DB_USERNAME`, default value = `appseed_db_usr` |
| 67 | + - `DB_PASS`, default value = `pass` |
| 68 | +- `OAuth` via Github |
| 69 | + - `GITHUB_ID`=<GITHUB_ID_HERE> |
| 70 | + - `GITHUB_SECRET`=<GITHUB_SECRET_HERE> |
| 71 | +- `OAuth` via Google |
| 72 | + - `GOOGLE_CLIENT_ID`=<GOOGLE_ID_HERE> |
| 73 | + - `GOOGLE_SECRET_KEY`=<GOOGLE_SECRET_HERE> |
| 74 | + |
| 75 | +<br /> |
| 76 | + |
| 77 | +## Manual Build |
| 78 | + |
| 79 | +> - Download the [code](https://appseed.us/product/material-dashboard2-pro/django/) and unzip the sources (requires a `purchase`). |
| 80 | +
|
| 81 | +```bash |
| 82 | +$ unzip django-material-dashboard2-enh.zip |
| 83 | +$ cd django-material-dashboard2-enh |
| 84 | +``` |
| 85 | + |
| 86 | +<br /> |
| 87 | + |
| 88 | +### 👉 Set Up for `Unix`, `MacOS` |
| 89 | + |
| 90 | +> Install modules via `VENV` |
| 91 | +
|
| 92 | +```bash |
| 93 | +$ virtualenv env |
| 94 | +$ source env/bin/activate |
| 95 | +$ pip3 install -r requirements.txt |
| 96 | +``` |
| 97 | + |
| 98 | +<br /> |
| 99 | + |
| 100 | +> Set Up Database |
| 101 | +
|
| 102 | +```bash |
| 103 | +$ python manage.py makemigrations |
| 104 | +$ python manage.py migrate |
| 105 | +``` |
| 106 | + |
| 107 | +<br /> |
| 108 | + |
| 109 | +> Create Superuser |
| 110 | +
|
| 111 | +```bash |
| 112 | +$ python manage.py createsuperuser |
| 113 | +``` |
| 114 | + |
| 115 | +<br /> |
| 116 | + |
| 117 | +> Start the app |
| 118 | +
|
| 119 | +```bash |
| 120 | +$ python manage.py runserver |
| 121 | +``` |
| 122 | + |
| 123 | +At this point, the app runs at `http://127.0.0.1:8000/`. |
| 124 | + |
| 125 | +<br /> |
| 126 | + |
| 127 | +### 👉 Set Up for `Windows` |
| 128 | + |
| 129 | +> Install modules via `VENV` (windows) |
| 130 | +
|
| 131 | +``` |
| 132 | +$ virtualenv env |
| 133 | +$ .\env\Scripts\activate |
| 134 | +$ pip3 install -r requirements.txt |
| 135 | +``` |
| 136 | + |
| 137 | +<br /> |
| 138 | + |
| 139 | +> Set Up Database |
| 140 | +
|
| 141 | +```bash |
| 142 | +$ python manage.py makemigrations |
| 143 | +$ python manage.py migrate |
| 144 | +``` |
| 145 | + |
| 146 | +<br /> |
| 147 | + |
| 148 | +> Start the app |
| 149 | +
|
| 150 | +```bash |
| 151 | +$ python manage.py runserver |
| 152 | +``` |
| 153 | + |
| 154 | +At this point, the app runs at `http://127.0.0.1:8000/`. |
| 155 | + |
| 156 | +<br /> |
| 157 | + |
| 158 | +### 👉 Create Users |
| 159 | + |
| 160 | +By default, the app redirects guest users to authenticate. In order to access the private pages, follow this set up: |
| 161 | + |
| 162 | +- Start the app |
| 163 | +- Access the `registration` page and create a new user: |
| 164 | + - `http://127.0.0.1:8000/register/` |
| 165 | +- Access the `sign in` page and authenticate |
| 166 | + - `http://127.0.0.1:8000/login/` |
| 167 | + |
| 168 | +<br /> |
| 169 | + |
| 170 | +## Enable Social Login |
| 171 | + |
| 172 | +> 👉 **Github Setup** - [Create an OAuth App](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app) |
| 173 | +
|
| 174 | +- SignIN to `Github` |
| 175 | +- Access `Settings` -> `Developer Settings` -> `OAuth Apps` |
| 176 | +- Edit your OAuth App |
| 177 | + - `App Name` |
| 178 | + - `App Description` |
| 179 | + - (mandatory) `HomePage`: `https://localhost:8000` |
| 180 | + - (mandatory) `Authorization callback URL`: `https://localhost:8000/` |
| 181 | + - Generate a new `secret key` |
| 182 | + |
| 183 | +<br /> |
| 184 | + |
| 185 | +## Codebase |
| 186 | + |
| 187 | +The project is coded using a simple and intuitive structure presented below: |
| 188 | + |
| 189 | +```bash |
| 190 | +< PROJECT ROOT > |
| 191 | + | |
| 192 | + |-- core/ # Implements app configuration |
| 193 | + | |-- settings.py # Defines Global Settings |
| 194 | + | |-- wsgi.py # Start the app in production |
| 195 | + | |-- urls.py # Define URLs served by all apps/nodes |
| 196 | + | |
| 197 | + |-- home/ # Serves all pages from the UI Kit |
| 198 | + | |
| 199 | + |-- apps/ |
| 200 | + | | |
| 201 | + | |-- common/ # Assets used by all APPS (models, helpers) |
| 202 | + | |-- users/ # Handles Auth Flow |
| 203 | + | |-- api/ # DRF API |
| 204 | + | |-- charts/ # Charts APP |
| 205 | + | |-- tables/ # DataTables APP |
| 206 | + | |-- tasks/ # Celery App |
| 207 | + | |
| 208 | + |-- templates/ # Pages & Templates |
| 209 | + |-- assets/ # Static Assets [ JS, CSS, images ] |
| 210 | + | |
| 211 | + |-- requirements.txt # Development modules - SQLite storage |
| 212 | + | |
| 213 | + |-- .env # Environment |
| 214 | + |-- env.sample # Environment Sample |
| 215 | + | |
| 216 | + |-- manage.py # Django Manager File |
| 217 | + | |
| 218 | + |-- ************************************************************************ |
| 219 | +``` |
| 220 | + |
| 221 | +<br /> |
| 222 | + |
| 223 | +--- |
| 224 | +[Django Material Dash2 PRO](https://appseed.us/product/material-dashboard2-pro/django/) - Starter crafted by **[AppSeed](https://appseed.us/)**. |
0 commit comments