|
| 1 | +# [Flask](https://appseed.us/boilerplate-code/flask-boilerplate) Pixel Lite |
| 2 | + |
| 3 | +Open-Source **Flask** starter coded with basic modules, database, ORM and deployment scripts on top of **Pixel Lite** UI Kit, a fully responsive and modern Bootstrap 4 UI Kit that will help you build creative and professional websites. |
| 4 | + |
| 5 | +<br /> |
| 6 | + |
| 7 | +> Flask Dashboard Features |
| 8 | +
|
| 9 | +- UI Kit: **Pixel Lite** (Free Version) by **Themesberg** |
| 10 | +- SQLite database, Flask-SQLAlchemy ORM |
| 11 | +- Session-Based auth flow (login, register) |
| 12 | +- Deployment scripts: Docker, Gunicorn / Nginx, Heroku |
| 13 | +- Support via **Github** (issues tracker) and [Discord](https://discord.gg/fZC6hup). |
| 14 | + |
| 15 | +<br /> |
| 16 | + |
| 17 | +> Links |
| 18 | +
|
| 19 | +- [Flask Pixel Lite](https://appseed.us/apps/flask-apps/flask-pixel-bootstrap-uikit) - product page |
| 20 | +- [Flask Pixel Lite - Demo](https://flask-pixel-lite.appseed-srv1.com/) - LIVE Deployment |
| 21 | + |
| 22 | +<br /> |
| 23 | + |
| 24 | +## Want more? Go PRO! |
| 25 | + |
| 26 | +PRO versions include **Premium UI Kits**, Lifetime updates and **24/7 LIVE Support** (via [Discord](https://discord.gg/fZC6hup)) |
| 27 | + |
| 28 | +| [Flask Datta PRO](https://appseed.us/admin-dashboards/flask-dashboard-dattaable-pro) | [Flask Material PRO](https://appseed.us/admin-dashboards/flask-dashboard-material-pro) | [Flask Volt PRO](https://appseed.us/admin-dashboards/flask-dashboard-volt-pro) | |
| 29 | +| --- | --- | --- | |
| 30 | +| [](https://appseed.us/admin-dashboards/flask-dashboard-dattaable-pro) | [](https://appseed.us/admin-dashboards/flask-dashboard-material-pro) | [](https://appseed.us/admin-dashboards/flask-dashboard-volt-pro) |
| 31 | + |
| 32 | +<br /> |
| 33 | +<br /> |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +<br /> |
| 38 | + |
| 39 | +## Build from sources |
| 40 | + |
| 41 | +```bash |
| 42 | +$ # Clone the sources |
| 43 | +$ git clone https://github.com/app-generator/flask-pixel-bootstrap-uikit.git |
| 44 | +$ cd flask-pixel-bootstrap-uikit |
| 45 | +$ |
| 46 | +$ # Virtualenv modules installation (Unix based systems) |
| 47 | +$ virtualenv env |
| 48 | +$ source env/bin/activate |
| 49 | +$ |
| 50 | +$ # Virtualenv modules installation (Windows based systems) |
| 51 | +$ # virtualenv env |
| 52 | +$ # .\env\Scripts\activate |
| 53 | +$ |
| 54 | +$ # Install requirements |
| 55 | +$ pip3 install -r requirements.txt |
| 56 | +$ |
| 57 | +$ # Set the FLASK_APP environment variable |
| 58 | +$ (Unix/Mac) export FLASK_APP=run.py |
| 59 | +$ (Windows) set FLASK_APP=run.py |
| 60 | +$ (Powershell) $env:FLASK_APP = ".\run.py" |
| 61 | +$ |
| 62 | +$ # Set up the DEBUG environment |
| 63 | +$ # (Unix/Mac) export FLASK_ENV=development |
| 64 | +$ # (Windows) set FLASK_ENV=development |
| 65 | +$ # (Powershell) $env:FLASK_ENV = "development" |
| 66 | +$ |
| 67 | +$ # Run the application |
| 68 | +$ # --host=0.0.0.0 - expose the app on all network interfaces (default 127.0.0.1) |
| 69 | +$ # --port=5000 - specify the app port (default 5000) |
| 70 | +$ flask run --host=0.0.0.0 --port=5000 |
| 71 | +$ |
| 72 | +$ # Access the app in browser: http://127.0.0.1:5000/ |
| 73 | +``` |
| 74 | + |
| 75 | +> Note: To use the app, please access the registration page and create a new user. After authentication, the app will unlock the private pages. |
| 76 | +
|
| 77 | +<br /> |
| 78 | + |
| 79 | +## Code-base structure |
| 80 | + |
| 81 | +The project has a super simple structure, represented as bellow: |
| 82 | + |
| 83 | +```bash |
| 84 | +< PROJECT ROOT > |
| 85 | + | |
| 86 | + |-- app/__init__.py |
| 87 | + |-- app/ |
| 88 | + | |-- static/ |
| 89 | + | | |-- <css, JS, images> # CSS files, Javascripts files |
| 90 | + | | |
| 91 | + | |-- templates/ |
| 92 | + | | | |
| 93 | + | | |-- includes/ # Page chunks, components |
| 94 | + | | | | |
| 95 | + | | | |-- navigation.html # Top bar |
| 96 | + | | | |-- sidebar.html # Left sidebar |
| 97 | + | | | |-- scripts.html # JS scripts common to all pages |
| 98 | + | | | |-- footer.html # The common footer |
| 99 | + | | | |
| 100 | + | | |-- layouts/ # App Layouts (the master pages) |
| 101 | + | | | | |
| 102 | + | | | |-- base.html # Used by common pages like index, UI |
| 103 | + | | | |-- base-fullscreen.html # Used by auth pages (login, register) |
| 104 | + | | | |
| 105 | + | | |-- accounts/ # Auth Pages (login, register) |
| 106 | + | | | | |
| 107 | + | | | |-- login.html # Use layout `base-fullscreen.html` |
| 108 | + | | | |-- register.html # Use layout `base-fullscreen.html` |
| 109 | + | | | |
| 110 | + | | index.html # The default page |
| 111 | + | | page-404.html # Error 404 page (page not found) |
| 112 | + | | page-500.html # Error 500 page (server error) |
| 113 | + | | *.html # All other pages provided by the UI Kit |
| 114 | + | |
| 115 | + |-- requirements.txt |
| 116 | + | |
| 117 | + |-- run.py |
| 118 | + | |
| 119 | + |-- ************************************************************************ |
| 120 | +``` |
| 121 | + |
| 122 | +<br /> |
| 123 | + |
| 124 | +## Deployment |
| 125 | + |
| 126 | +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/). |
| 127 | + |
| 128 | +<br /> |
| 129 | + |
| 130 | +### [Docker](https://www.docker.com/) execution |
| 131 | +--- |
| 132 | + |
| 133 | +The application can be easily executed in a docker container. The steps: |
| 134 | + |
| 135 | +> Get the code |
| 136 | +
|
| 137 | +```bash |
| 138 | +$ git clone https://github.com/app-generator/flask-pixel-bootstrap-uikit.git |
| 139 | +$ cd flask-pixel-bootstrap-uikit |
| 140 | +``` |
| 141 | + |
| 142 | +> Start the app in Docker |
| 143 | +
|
| 144 | +```bash |
| 145 | +$ sudo docker-compose pull && sudo docker-compose build && sudo docker-compose up -d |
| 146 | +``` |
| 147 | + |
| 148 | +Visit `http://localhost:5005` in your browser. The app should be up & running. |
| 149 | + |
| 150 | +<br /> |
| 151 | + |
| 152 | +### [Heroku](https://www.heroku.com/) |
| 153 | +--- |
| 154 | + |
| 155 | +Steps to deploy on **Heroku** |
| 156 | + |
| 157 | +- [Create a FREE account](https://signup.heroku.com/) on Heroku platform |
| 158 | +- [Install the Heroku CLI](https://devcenter.heroku.com/articles/getting-started-with-python#set-up) that match your OS: Mac, Unix or Windows |
| 159 | +- Open a terminal window and authenticate via `heroku login` command |
| 160 | +- Clone the sources and push the project for LIVE deployment |
| 161 | + |
| 162 | +```bash |
| 163 | +$ # Clone the source code: |
| 164 | +$ git clone https://github.com/app-generator/flask-pixel-bootstrap-uikit.git |
| 165 | +$ cd flask-pixel-bootstrap-uikit |
| 166 | +$ |
| 167 | +$ # Check Heroku CLI is installed |
| 168 | +$ heroku -v |
| 169 | +heroku/7.25.0 win32-x64 node-v12.13.0 # <-- All good |
| 170 | +$ |
| 171 | +$ # Check Heroku CLI is installed |
| 172 | +$ heroku login |
| 173 | +$ # this commaond will open a browser window - click the login button (in browser) |
| 174 | +$ |
| 175 | +$ # Create the Heroku project |
| 176 | +$ heroku create |
| 177 | +$ |
| 178 | +$ # Trigger the LIVE deploy |
| 179 | +$ git push heroku master |
| 180 | +$ |
| 181 | +$ # Open the LIVE app in browser |
| 182 | +$ heroku open |
| 183 | +``` |
| 184 | + |
| 185 | +<br /> |
| 186 | + |
| 187 | +### [Gunicorn](https://gunicorn.org/) |
| 188 | +--- |
| 189 | + |
| 190 | +Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. |
| 191 | + |
| 192 | +> Install using pip |
| 193 | +
|
| 194 | +```bash |
| 195 | +$ pip install gunicorn |
| 196 | +``` |
| 197 | +> Start the app using gunicorn binary |
| 198 | +
|
| 199 | +```bash |
| 200 | +$ gunicorn --bind 0.0.0.0:8001 run:app |
| 201 | +Serving on http://localhost:8001 |
| 202 | +``` |
| 203 | + |
| 204 | +Visit `http://localhost:8001` in your browser. The app should be up & running. |
| 205 | + |
| 206 | +<br /> |
| 207 | + |
| 208 | +### [Waitress](https://docs.pylonsproject.org/projects/waitress/en/stable/) |
| 209 | +--- |
| 210 | + |
| 211 | +Waitress (Gunicorn equivalent for Windows) is meant to be a production-quality pure-Python WSGI server with very acceptable performance. It has no dependencies except ones that live in the Python standard library. |
| 212 | + |
| 213 | +> Install using pip |
| 214 | +
|
| 215 | +```bash |
| 216 | +$ pip install waitress |
| 217 | +``` |
| 218 | +> Start the app using [waitress-serve](https://docs.pylonsproject.org/projects/waitress/en/stable/runner.html) |
| 219 | +
|
| 220 | +```bash |
| 221 | +$ waitress-serve --port=8001 run:app |
| 222 | +Serving on http://localhost:8001 |
| 223 | +``` |
| 224 | + |
| 225 | +Visit `http://localhost:8001` in your browser. The app should be up & running. |
| 226 | + |
| 227 | +<br /> |
| 228 | + |
| 229 | +## Credits & Links |
| 230 | + |
| 231 | +- [Flask Framework](https://www.palletsprojects.com/p/flask/) - The official website |
| 232 | +- [Boilerplate Code](https://appseed.us/boilerplate-code) - Index provided by **AppSeed** |
| 233 | +- [Boilerplate Code](https://github.com/app-generator/boilerplate-code) - Index published on Github |
| 234 | + |
| 235 | +<br /> |
| 236 | + |
| 237 | +--- |
| 238 | +[Flask](https://appseed.us/boilerplate-code/flask-boilerplate) Pixel Lite - Provided by **AppSeed** [App Generator](https://appseed.us/app-generator). |
0 commit comments