66
77> Features
88
9+ - Up-to-date [ dependencies] ( ./requirements.txt ) : ** Flask 2.0.1**
10+ - [ SCSS compilation] ( #recompile-css ) via ** Gulp**
911- DBMS: SQLite, PostgreSQL (production)
1012- DB Tools: SQLAlchemy ORM, Flask-Migrate (schema migrations)
1113- Modular design with ** Blueprints** , simple codebase
@@ -83,112 +85,59 @@ $ # Access the dashboard in browser: http://127.0.0.1:5000/
8385
8486## Code-base structure
8587
86- The project is coded using blueprints, app factory pattern, dual configuration profile (development and production) and an intuitive structure presented bellow:
87-
88- > Simplified version
88+ The project is coded using blueprints, app factory pattern, dual configuration profile (development and production), and an intuitive structure presented below:
8989
9090``` bash
9191< PROJECT ROOT >
9292 |
93- | -- app/ # Implements app logic
94- | | -- base/ # Base Blueprint - handles the authentication
95- | | -- home/ # Home Blueprint - serve UI Kit pages
93+ | -- apps/
9694 | |
97- | __init__.py # Initialize the app
98- |
99- | -- requirements.txt # Development modules - SQLite storage
100- | -- requirements-mysql.txt # Production modules - Mysql DMBS
101- | -- requirements-pqsql.txt # Production modules - PostgreSql DMBS
102- |
103- | -- .env # Inject Configuration via Environment
104- | -- config.py # Set up the app
105- | -- run.py # Start the app - WSGI gateway
106- |
107- | -- ************************************************************************
108- ```
109-
110- <br />
111-
112- > The bootstrap flow
113-
114- - ` run.py ` loads the ` .env ` file
115- - Initialize the app using the specified profile: * Debug* or * Production*
116- - If env.DEBUG is set to * True* the SQLite storage is used
117- - If env.DEBUG is set to * False* the specified DB driver is used (MySql, PostgreSQL)
118- - Call the app factory method ` create_app ` defined in app/__ init__ .py
119- - Redirect the guest users to Login page
120- - Unlock the pages served by * home* blueprint for authenticated users
121-
122- <br />
123-
124- > App / Base Blueprint
125-
126- The * Base* blueprint handles the authentication (routes and forms) and assets management. The structure is presented below:
127-
128- ``` bash
129- < PROJECT ROOT >
130- |
131- | -- app/
132- | | -- home/ # Home Blueprint - serve app pages (private area)
133- | | -- base/ # Base Blueprint - handles the authentication
134- | | -- static/
135- | | | -- < css, JS, images> # CSS files, Javascripts files
136- | |
137- | | -- templates/ # Templates used to render pages
138- | |
139- | | -- includes/ #
140- | | | -- navigation.html # Top menu component
141- | | | -- sidebar.html # Sidebar component
142- | | | -- footer.html # App Footer
143- | | | -- scripts.html # Scripts common to all pages
144- | |
145- | | -- layouts/ # Master pages
146- | | | -- base-fullscreen.html # Used by Authentication pages
147- | | | -- base.html # Used by common pages
148- | |
149- | | -- accounts/ # Authentication pages
150- | | -- login.html # Login page
151- | | -- register.html # Registration page
152- |
153- | -- requirements.txt # Development modules - SQLite storage
154- | -- requirements-mysql.txt # Production modules - Mysql DMBS
155- | -- requirements-pqsql.txt # Production modules - PostgreSql DMBS
156- |
157- | -- .env # Inject Configuration via Environment
158- | -- config.py # Set up the app
159- | -- run.py # Start the app - WSGI gateway
160- |
161- | -- ************************************************************************
162- ```
163-
164- <br />
165-
166- > App / Home Blueprint
167-
168- The * Home* blueprint handles UI Kit pages for authenticated users. This is the private zone of the app - the structure is presented below:
169-
170- ``` bash
171- < PROJECT ROOT >
95+ | | -- home/ # A simple app that serve HTML files
96+ | | | -- routes.py # Define app routes
97+ | |
98+ | | -- authentication/ # Handles auth routes (login and register)
99+ | | | -- routes.py # Define authentication routes
100+ | | | -- models.py # Defines models
101+ | | | -- forms.py # Define auth forms (login and register)
102+ | |
103+ | | -- static/
104+ | | | -- < css, JS, images> # CSS files, Javascripts files
105+ | |
106+ | | -- templates/ # Templates used to render pages
107+ | | | -- includes/ # HTML chunks and components
108+ | | | | -- navigation.html # Top menu component
109+ | | | | -- sidebar.html # Sidebar component
110+ | | | | -- footer.html # App Footer
111+ | | | | -- scripts.html # Scripts common to all pages
112+ | | |
113+ | | | -- layouts/ # Master pages
114+ | | | | -- base-fullscreen.html # Used by Authentication pages
115+ | | | | -- base.html # Used by common pages
116+ | | |
117+ | | | -- accounts/ # Authentication pages
118+ | | | | -- login.html # Login page
119+ | | | | -- register.html # Register page
120+ | | |
121+ | | | -- home/ # UI Kit Pages
122+ | | | -- index.html # Index page
123+ | | | -- 404-page.html # 404 page
124+ | | | -- * .html # All other pages
125+ | |
126+ | config.py # Set up the app
127+ | __init__.py # Initialize the app
172128 |
173- | -- app/
174- | | -- base/ # Base Blueprint - handles the authentication
175- | | -- home/ # Home Blueprint - serve app pages (private area)
176- | |
177- | | -- templates/ # UI Kit Pages
178- | |
179- | | -- index.html # Default page
180- | | -- page-404.html # Error 404 - mandatory page
181- | | -- page-500.html # Error 500 - mandatory page
182- | | -- page-403.html # Error 403 - mandatory page
183- | | -- * .html # All other HTML pages
129+ | -- requirements.txt # Development modules - SQLite storage
130+ | -- requirements-mysql.txt # Production modules - Mysql DMBS
131+ | -- requirements-pqsql.txt # Production modules - PostgreSql DMBS
184132 |
185- | -- requirements.txt # Development modules - SQLite storage
186- | -- requirements-mysql.txt # Production modules - Mysql DMBS
187- | -- requirements-pqsql.txt # Production modules - PostgreSql DMBS
133+ | -- Dockerfile # Deployment
134+ | -- docker-compose.yml # Deployment
135+ | -- gunicorn-cfg.py # Deployment
136+ | -- nginx # Deployment
137+ | | -- appseed-app.conf # Deployment
188138 |
189- | -- .env # Inject Configuration via Environment
190- | -- config.py # Set up the app
191- | -- run.py # Start the app - WSGI gateway
139+ | -- .env # Inject Configuration via Environment
140+ | -- run.py # Start the app - WSGI gateway
192141 |
193142 | -- ************************************************************************
194143```
@@ -213,7 +162,7 @@ To recompile SCSS files, follow this setup:
213162** Step #2 ** - Change the working directory to ` assets ` folder
214163
215164``` bash
216- $ cd app/base /static/assets
165+ $ cd apps /static/assets
217166```
218167
219168<br />
@@ -262,7 +211,7 @@ $ cd flask-dashboard-volt
262211$ sudo docker-compose pull && sudo docker-compose build && sudo docker-compose up -d
263212```
264213
265- Visit ` http://localhost:5005 ` in your browser. The app should be up & running.
214+ Visit ` http://localhost:85 ` in your browser. The app should be up & running.
266215
267216<br />
268217
0 commit comments