|
1 | | -# Flask Material PRO (WrapPixel) |
| 1 | +# [Flask Material PRO Wpx](https://appseed.us/admin-dashboards/flask-material-dashboard-wpx-pro) |
2 | 2 |
|
3 | | -> Template [boilerplate code](https://appseed.us/boilerplate-code) used by [AppSeed](https://appseed.us) to generate simple admin dashboards coded in [Flask](https://palletsprojects.com/p/flask/) - Features: |
| 3 | +`Admin dashboard` generated by the AppSeed platform with basic modules, database, authentication and deployment scripts on top of a modern design. Based on the popular Bootstrap 4 framework and inspired by Google’s material design, the MaterialPro Bootstrap Admin template is bundled with multiple third-party plugins that make it an excellent standalone solution. |
4 | 4 |
|
5 | | -- UI Kit: **Material PRO Dashboard** (Lite Version) provided by **WrapPixel** |
| 5 | +<br /> |
| 6 | + |
| 7 | +> Features |
| 8 | +
|
| 9 | +- `Up-to-date dependencies`: **Flask 2.0.1** |
| 10 | +- [SCSS compilation](#recompile-css) via **Gulp** |
6 | 11 | - DBMS: SQLite, PostgreSQL (production) |
7 | 12 | - DB Tools: SQLAlchemy ORM, Flask-Migrate (schema migrations) |
8 | | -- Modular design with **Blueprints** |
| 13 | +- Modular design with **Blueprints**, simple codebase |
9 | 14 | - Session-Based authentication (via **flask_login**), Forms validation |
10 | | -- Deployment scripts: Docker, Gunicorn / Nginx, HEROKU |
11 | | -- Support via **Github** (issues tracker) and [Discord](https://discord.gg/fZC6hup). |
| 15 | +- Deployment scripts: Docker, Gunicorn / Nginx, Heroku |
| 16 | +- Support via **Github** and [Discord](https://discord.gg/fZC6hup). |
12 | 17 |
|
13 | 18 | <br /> |
14 | 19 |
|
15 | 20 | > Links |
16 | 21 |
|
17 | 22 | - [Flask Material PRO Wpx](https://appseed.us/admin-dashboards/flask-material-dashboard-wpx-pro) - product page |
18 | 23 | - [Flask Material PRO Wpx](https://flask-material-wpx-pro.appseed-srv1.com) - LIVE Demo |
19 | | -- [Flask Material PRO Wpx](https://docs.appseed.us/products/flask-dashboards/materialpro-wpx) - product documentation |
| 24 | + |
| 25 | +<br /> |
| 26 | + |
| 27 | +## Quick Start in [Docker](https://www.docker.com/) |
| 28 | + |
| 29 | +> Get the code |
| 30 | +
|
| 31 | +```bash |
| 32 | +$ git clone https://github.com/app-generator/priv-flask-material-wpx-pro.git |
| 33 | +$ cd priv-flask-material-wpx-pro |
| 34 | +``` |
| 35 | + |
| 36 | +> Start the app in Docker |
| 37 | +
|
| 38 | +```bash |
| 39 | +$ docker-compose pull # download dependencies |
| 40 | +$ docker-compose build # local set up |
| 41 | +$ docker-compose up -d # start the app |
| 42 | +``` |
| 43 | + |
| 44 | +Visit `http://localhost:85` in your browser. The app should be up & running. |
20 | 45 |
|
21 | 46 | <br /> |
22 | 47 |
|
@@ -69,145 +94,112 @@ $ # Access the dashboard in browser: http://127.0.0.1:5000/ |
69 | 94 |
|
70 | 95 | ## Code-base structure |
71 | 96 |
|
72 | | -The project is coded using blueprints, app factory pattern, dual configuration profile (development and production) and an intuitive structure presented bellow: |
73 | | - |
74 | | -> Simplified version |
| 97 | +The project is coded using blueprints, app factory pattern, dual configuration profile (development and production), and an intuitive structure presented below: |
75 | 98 |
|
76 | 99 | ```bash |
77 | 100 | < PROJECT ROOT > |
78 | 101 | | |
79 | | - |-- app/ # Implements app logic |
80 | | - | |-- base/ # Base Blueprint - handles the authentication |
81 | | - | |-- home/ # Home Blueprint - serve UI Kit pages |
| 102 | + |-- apps/ |
| 103 | + | | |
| 104 | + | |-- home/ # A simple app that serve HTML files |
| 105 | + | | |-- routes.py # Define app routes |
| 106 | + | | |
| 107 | + | |-- authentication/ # Handles auth routes (login and register) |
| 108 | + | | |-- routes.py # Define authentication routes |
| 109 | + | | |-- models.py # Defines models |
| 110 | + | | |-- forms.py # Define auth forms (login and register) |
82 | 111 | | | |
83 | | - | __init__.py # Initialize the app |
| 112 | + | |-- static/ |
| 113 | + | | |-- <css, JS, images> # CSS files, Javascripts files |
| 114 | + | | |
| 115 | + | |-- templates/ # Templates used to render pages |
| 116 | + | | |-- includes/ # HTML chunks and components |
| 117 | + | | | |-- navigation.html # Top menu component |
| 118 | + | | | |-- sidebar.html # Sidebar component |
| 119 | + | | | |-- footer.html # App Footer |
| 120 | + | | | |-- scripts.html # Scripts common to all pages |
| 121 | + | | | |
| 122 | + | | |-- layouts/ # Master pages |
| 123 | + | | | |-- base-fullscreen.html # Used by Authentication pages |
| 124 | + | | | |-- base.html # Used by common pages |
| 125 | + | | | |
| 126 | + | | |-- accounts/ # Authentication pages |
| 127 | + | | | |-- login.html # Login page |
| 128 | + | | | |-- register.html # Register page |
| 129 | + | | | |
| 130 | + | | |-- home/ # UI Kit Pages |
| 131 | + | | |-- index.html # Index page |
| 132 | + | | |-- 404-page.html # 404 page |
| 133 | + | | |-- *.html # All other pages |
| 134 | + | | |
| 135 | + | config.py # Set up the app |
| 136 | + | __init__.py # Initialize the app |
| 137 | + | |
| 138 | + |-- requirements.txt # Development modules - SQLite storage |
| 139 | + |-- requirements-mysql.txt # Production modules - Mysql DMBS |
| 140 | + |-- requirements-pqsql.txt # Production modules - PostgreSql DMBS |
84 | 141 | | |
85 | | - |-- requirements.txt # Development modules - SQLite storage |
86 | | - |-- requirements-mysql.txt # Production modules - Mysql DMBS |
87 | | - |-- requirements-pqsql.txt # Production modules - PostgreSql DMBS |
| 142 | + |-- Dockerfile # Deployment |
| 143 | + |-- docker-compose.yml # Deployment |
| 144 | + |-- gunicorn-cfg.py # Deployment |
| 145 | + |-- nginx # Deployment |
| 146 | + | |-- appseed-app.conf # Deployment |
88 | 147 | | |
89 | | - |-- .env # Inject Configuration via Environment |
90 | | - |-- config.py # Set up the app |
91 | | - |-- run.py # Start the app - WSGI gateway |
| 148 | + |-- .env # Inject Configuration via Environment |
| 149 | + |-- run.py # Start the app - WSGI gateway |
92 | 150 | | |
93 | 151 | |-- ************************************************************************ |
94 | 152 | ``` |
95 | 153 |
|
96 | 154 | <br /> |
97 | 155 |
|
98 | | -> The bootstrap flow |
| 156 | +## Recompile CSS |
99 | 157 |
|
100 | | -- `run.py` loads the `.env` file |
101 | | -- Initialize the app using the specified profile: *Debug* or *Production* |
102 | | - - If env.DEBUG is set to *True* the SQLite storage is used |
103 | | - - If env.DEBUG is set to *False* the specified DB driver is used (MySql, PostgreSQL) |
104 | | -- Call the app factory method `create_app` defined in app/__init__.py |
105 | | -- Redirect the guest users to Login page |
106 | | -- Unlock the pages served by *home* blueprint for authenticated users |
| 158 | +To recompile SCSS files, follow this setup: |
107 | 159 |
|
108 | 160 | <br /> |
109 | 161 |
|
110 | | -> App / Base Blueprint |
| 162 | +**Step #1** - Install tools |
111 | 163 |
|
112 | | -The *Base* blueprint handles the authentication (routes and forms) and assets management. The structure is presented below: |
113 | | - |
114 | | -```bash |
115 | | -< PROJECT ROOT > |
116 | | - | |
117 | | - |-- app/ |
118 | | - | |-- home/ # Home Blueprint - serve app pages (private area) |
119 | | - | |-- base/ # Base Blueprint - handles the authentication |
120 | | - | |-- static/ |
121 | | - | | |-- <css, JS, images> # CSS files, Javascripts files |
122 | | - | | |
123 | | - | |-- templates/ # Templates used to render pages |
124 | | - | | |
125 | | - | |-- includes/ # |
126 | | - | | |-- navigation.html # Top menu component |
127 | | - | | |-- sidebar.html # Sidebar component |
128 | | - | | |-- footer.html # App Footer |
129 | | - | | |-- scripts.html # Scripts common to all pages |
130 | | - | | |
131 | | - | |-- layouts/ # Master pages |
132 | | - | | |-- base-fullscreen.html # Used by Authentication pages |
133 | | - | | |-- base.html # Used by common pages |
134 | | - | | |
135 | | - | |-- accounts/ # Authentication pages |
136 | | - | |-- login.html # Login page |
137 | | - | |-- register.html # Registration page |
138 | | - | |
139 | | - |-- requirements.txt # Development modules - SQLite storage |
140 | | - |-- requirements-mysql.txt # Production modules - Mysql DMBS |
141 | | - |-- requirements-pqsql.txt # Production modules - PostgreSql DMBS |
142 | | - | |
143 | | - |-- .env # Inject Configuration via Environment |
144 | | - |-- config.py # Set up the app |
145 | | - |-- run.py # Start the app - WSGI gateway |
146 | | - | |
147 | | - |-- ************************************************************************ |
148 | | -``` |
| 164 | +- [NodeJS](https://nodejs.org/en/) 12.x or higher |
| 165 | +- [Gulp](https://gulpjs.com/) - globally |
| 166 | + - `npm install -g gulp-cli` |
| 167 | +- [Yarn](https://yarnpkg.com/) (optional) |
149 | 168 |
|
150 | 169 | <br /> |
151 | 170 |
|
152 | | -> App / Home Blueprint |
153 | | -
|
154 | | -The *Home* blueprint handles UI Kit pages for authenticated users. This is the private zone of the app - the structure is presented below: |
| 171 | +**Step #2** - Change the working directory to `assets` folder |
155 | 172 |
|
156 | 173 | ```bash |
157 | | -< PROJECT ROOT > |
158 | | - | |
159 | | - |-- app/ |
160 | | - | |-- base/ # Base Blueprint - handles the authentication |
161 | | - | |-- home/ # Home Blueprint - serve app pages (private area) |
162 | | - | | |
163 | | - | |-- templates/ # UI Kit Pages |
164 | | - | | |
165 | | - | |-- index.html # Default page |
166 | | - | |-- page-404.html # Error 404 - mandatory page |
167 | | - | |-- page-500.html # Error 500 - mandatory page |
168 | | - | |-- page-403.html # Error 403 - mandatory page |
169 | | - | |-- *.html # All other HTML pages |
170 | | - | |
171 | | - |-- requirements.txt # Development modules - SQLite storage |
172 | | - |-- requirements-mysql.txt # Production modules - Mysql DMBS |
173 | | - |-- requirements-pqsql.txt # Production modules - PostgreSql DMBS |
174 | | - | |
175 | | - |-- .env # Inject Configuration via Environment |
176 | | - |-- config.py # Set up the app |
177 | | - |-- run.py # Start the app - WSGI gateway |
178 | | - | |
179 | | - |-- ************************************************************************ |
| 174 | +$ cd apps/static/assets |
180 | 175 | ``` |
181 | 176 |
|
182 | 177 | <br /> |
183 | 178 |
|
184 | | -## Deployment |
| 179 | +**Step #3** - Install modules (this will create a classic `node_modules` directory) |
185 | 180 |
|
186 | | -The app is provided with a basic configuration to be executed in [Docker](https://www.docker.com/), [Heroku](https://www.heroku.com/), [Gunicorn](https://gunicorn.org/), and [Waitress](https://docs.pylonsproject.org/projects/waitress/en/stable/). |
| 181 | +```bash |
| 182 | +$ npm install |
| 183 | +// OR |
| 184 | +$ yarn |
| 185 | +``` |
187 | 186 |
|
188 | 187 | <br /> |
189 | 188 |
|
190 | | -### [Docker](https://www.docker.com/) execution |
191 | | ---- |
192 | | - |
193 | | -The application can be easily executed in a docker container. The steps: |
194 | | - |
195 | | -> Get the code |
| 189 | +**Step #4** - Edit & Recompile SCSS files |
196 | 190 |
|
197 | 191 | ```bash |
198 | | -$ git clone https://github.com/app-generator/priv-flask-material-wpx-pro.git |
199 | | -$ cd priv-flask-material-wpx-pro |
| 192 | +$ gulp scss |
200 | 193 | ``` |
201 | 194 |
|
202 | | -> Start the app in Docker |
| 195 | +The generated file is saved in `static/assets/css` directory. |
203 | 196 |
|
204 | | -```bash |
205 | | -$ sudo docker-compose pull && sudo docker-compose build && sudo docker-compose up -d |
206 | | -``` |
| 197 | +<br /> |
207 | 198 |
|
208 | | -Visit `http://localhost:5005` in your browser. The app should be up & running. |
| 199 | +## Deployment |
| 200 | + |
| 201 | +The app is provided with a basic configuration to be executed in [Docker](https://www.docker.com/), [Heroku](https://www.heroku.com/), [Gunicorn](https://gunicorn.org/), and [Waitress](https://docs.pylonsproject.org/projects/waitress/en/stable/). |
209 | 202 |
|
210 | | -<br /> |
211 | 203 |
|
212 | 204 | ### [Heroku](https://www.heroku.com/) |
213 | 205 | --- |
@@ -295,4 +287,4 @@ Visit `http://localhost:8001` in your browser. The app should be up & running. |
295 | 287 | <br /> |
296 | 288 |
|
297 | 289 | --- |
298 | | -[Flask Material Dashboard PRO (WrapPixel)](https://appseed.us/admin-dashboards/flask-material-dashboard-wpx-pro) - Provided by **AppSeed** [Web App Generator](https://appseed.us/app-generator). |
| 290 | +[Flask Material PRO Wpx](https://appseed.us/admin-dashboards/flask-material-dashboard-wpx-pro) - Provided by **AppSeed** [App Generator](https://appseed.us/app-generator). |
0 commit comments