|
| 1 | +--- |
| 2 | +title: Flask Material Dash2 PRO - Premium Starter |
| 3 | +sidebar_label: Flask Material Dash2 PRO |
| 4 | +--- |
| 5 | + |
| 6 | +# [Flask Material Dash 2 PRO](https://appseed.us/product/material-dashboard2-pro/flask/) |
| 7 | + |
| 8 | +**Flask** starter styled with **[Material Dashboard PRO](https://appseed.us/product/material-dashboard2-pro/flask/)**, a premium `Bootstrap 5` KIT from [Creative-Tim](https://bit.ly/3fKQZaL). |
| 9 | +The product is designed to deliver the best possible user experience with highly customizable feature-rich pages. |
| 10 | + |
| 11 | +- 👉 [Flask Material 2 PRO](https://appseed.us/product/material-dashboard2-pro/flask/) - Product page |
| 12 | +- 👉 [Flask Material 2 PRO](https://flask-material-dashboard2-pro.appseed-srv1.com) - LIVE Demo |
| 13 | + |
| 14 | +> Features |
| 15 | +
|
| 16 | +- ✅ `Up-to-date dependencies` |
| 17 | +- ✅ UI Kit: [Material Dashboard 2](https://www.creative-tim.com/product/material-dashboard-pro?AFFILIATE=128200) (BS5 Version) by `Creative-Tim` |
| 18 | +- ✅ `Database`: `SQLite`, MySql |
| 19 | + - Silent fallback to `SQLite` |
| 20 | +- ✅ `DB Tools`: SQLAlchemy ORM, `Flask-Migrate` |
| 21 | +- ✅ `Authentication`, Session Based, `OAuth` via **Github** |
| 22 | +- ✅ Docker, `Flask-Minify` (page compression) |
| 23 | +- 🚀 `Deployment` |
| 24 | + - `CI/CD` flow via `Render` |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +## Environment |
| 30 | + |
| 31 | +To use the starter, [Python3](https://www.python.org) should be installed properly in the workstation. |
| 32 | +If you are not sure if Python is installed, please open a terminal and type `python --version`. Here is the full list with dependencies and tools required to build the app: |
| 33 | + |
| 34 | +- [Python3](https://www.python.org) - the programming language used to code the app |
| 35 | +- [GIT](https://git-scm.com) - used to clone the source code from the Github repository |
| 36 | +- Basic development tools (g++ compiler, python development libraries ..etc) used by Python to compile the app dependencies in your environment. |
| 37 | +- (Optional) `Docker` - a popular virtualization software |
| 38 | + |
| 39 | + |
| 40 | +## Start the app in Docker |
| 41 | + |
| 42 | +> 👉 **Step 1** - Download & Unzip the code (`requires a purchase` from the official [product](https://appseed.us/product/material-dashboard2-pro/flask/) page) |
| 43 | +
|
| 44 | +```bash |
| 45 | +$ unzip flask-material-dashboard2-pro.zip |
| 46 | +$ cd flask-material-dashboard2-pro |
| 47 | +``` |
| 48 | + |
| 49 | +> 👉 **Step 2** - Start the APP in `Docker` |
| 50 | +
|
| 51 | +```bash |
| 52 | +$ docker-compose up --build |
| 53 | +``` |
| 54 | + |
| 55 | +Visit `http://localhost:5085` in your browser. The app should be up & running. |
| 56 | + |
| 57 | + |
| 58 | +## Manual Build |
| 59 | + |
| 60 | +> 👉 **Step 1** - Download & Unzip the code (`requires a purchase` from the official [product](https://appseed.us/product/material-dashboard2-pro/flask/) page) |
| 61 | +
|
| 62 | +```bash |
| 63 | +$ unzip flask-material-dashboard2-pro.zip |
| 64 | +$ cd flask-material-dashboard2-pro |
| 65 | +``` |
| 66 | + |
| 67 | +### 👉 Set Up for `Unix`, `MacOS` |
| 68 | + |
| 69 | +> Install modules via `VENV` |
| 70 | +
|
| 71 | +```bash |
| 72 | +$ virtualenv env |
| 73 | +$ source env/bin/activate |
| 74 | +$ pip3 install -r requirements.txt |
| 75 | +``` |
| 76 | + |
| 77 | +> Set Up Flask Environment |
| 78 | +
|
| 79 | +```bash |
| 80 | +$ export FLASK_APP=run.py |
| 81 | +$ export FLASK_ENV=development |
| 82 | +``` |
| 83 | + |
| 84 | +> Start the app |
| 85 | +
|
| 86 | +```bash |
| 87 | +$ flask run |
| 88 | +``` |
| 89 | + |
| 90 | +At this point, the app runs at `http://127.0.0.1:5000/`. |
| 91 | + |
| 92 | + |
| 93 | +### 👉 Set Up for `Windows` |
| 94 | + |
| 95 | +> Install modules via `VENV` (windows) |
| 96 | +
|
| 97 | +``` |
| 98 | +$ virtualenv env |
| 99 | +$ .\env\Scripts\activate |
| 100 | +$ pip3 install -r requirements.txt |
| 101 | +``` |
| 102 | + |
| 103 | +> Set Up Flask Environment |
| 104 | +
|
| 105 | +```bash |
| 106 | +$ # CMD |
| 107 | +$ set FLASK_APP=run.py |
| 108 | +$ set FLASK_ENV=development |
| 109 | +$ |
| 110 | +$ # Powershell |
| 111 | +$ $env:FLASK_APP = ".\run.py" |
| 112 | +$ $env:FLASK_ENV = "development" |
| 113 | +``` |
| 114 | + |
| 115 | +> Start the app |
| 116 | +
|
| 117 | +```bash |
| 118 | +$ flask run |
| 119 | +``` |
| 120 | + |
| 121 | +At this point, the app runs at `http://127.0.0.1:5000/`. |
| 122 | + |
| 123 | + |
| 124 | +## Manage App `Users` |
| 125 | + |
| 126 | +By default, the starter is not provided with users. |
| 127 | + |
| 128 | +### 👉 Create Users |
| 129 | + |
| 130 | +By default, the app redirects guest users to authenticate. In order to access the private pages, follow this set up: |
| 131 | + |
| 132 | +- Start the app via `flask run` |
| 133 | +- Access the `registration` page and create a new user: |
| 134 | + - `http://127.0.0.1:5000/register` |
| 135 | +- Access the `sign in` page and authenticate |
| 136 | + - `http://127.0.0.1:5000/login` |
| 137 | + |
| 138 | + |
| 139 | +## Codebase structure |
| 140 | + |
| 141 | +The project is coded using a simple and intuitive structure presented below: |
| 142 | + |
| 143 | +```bash |
| 144 | +< PROJECT ROOT > |
| 145 | + | |
| 146 | + |-- apps/ |
| 147 | + | | |
| 148 | + | |-- home/ # A simple app that serve HTML files |
| 149 | + | | |-- routes.py # Define app routes |
| 150 | + | | |
| 151 | + | |-- authentication/ # Handles auth routes (login and register) |
| 152 | + | | |-- routes.py # Define authentication routes |
| 153 | + | | |-- models.py # Defines models |
| 154 | + | | |-- forms.py # Define auth forms (login and register) |
| 155 | + | | |
| 156 | + | |-- static/ |
| 157 | + | | |-- <css, JS, images> # CSS files, Javascripts files |
| 158 | + | | |
| 159 | + | |-- templates/ # Templates used to render pages |
| 160 | + | | |-- includes/ # HTML chunks and components |
| 161 | + | | | |-- navigation.html # Top menu component |
| 162 | + | | | |-- sidebar.html # Sidebar component |
| 163 | + | | | |-- footer.html # App Footer |
| 164 | + | | | |-- scripts.html # Scripts common to all pages |
| 165 | + | | | |
| 166 | + | | |-- layouts/ # Master pages |
| 167 | + | | | |-- base-fullscreen.html # Used by Authentication pages |
| 168 | + | | | |-- base.html # Used by common pages |
| 169 | + | | | |
| 170 | + | | |-- accounts/ # Authentication pages |
| 171 | + | | | |-- login.html # Login page |
| 172 | + | | | |-- register.html # Register page |
| 173 | + | | | |
| 174 | + | | |-- home/ # UI Kit Pages |
| 175 | + | | |-- index.html # Index page |
| 176 | + | | |-- 404-page.html # 404 page |
| 177 | + | | |-- *.html # All other pages |
| 178 | + | | |
| 179 | + | config.py # Set up the app |
| 180 | + | __init__.py # Initialize the app |
| 181 | + | |
| 182 | + |-- requirements.txt # App Dependencies |
| 183 | + | |
| 184 | + |-- .env # Inject Configuration via Environment |
| 185 | + |-- run.py # Start the app - WSGI gateway |
| 186 | + | |
| 187 | + |-- ************************************************************************ |
| 188 | +``` |
| 189 | + |
| 190 | +## Deploy on [Render](https://render.com/) |
| 191 | + |
| 192 | +- Create a Blueprint instance |
| 193 | + - Go to https://dashboard.render.com/blueprints this link. |
| 194 | +- Click `New Blueprint Instance` button. |
| 195 | +- Connect your `repo` which you want to deploy. |
| 196 | +- Fill the `Service Group Name` and click on `Update Existing Resources` button. |
| 197 | +- After that your deployment will start automatically. |
| 198 | + |
| 199 | +At this point, the product should be LIVE. |
| 200 | + |
| 201 | + |
| 202 | +## Resources |
| 203 | + |
| 204 | +- 👉 [Flask Material Dashboard](https://appseed.us/product/material-dashboard/flask/) - the `open-source` version |
| 205 | +- 👉 Free [Support](https://appseed.us/support/) via Email & Discord |
0 commit comments