|
| 1 | +# [CoreUI](https://appseed.us/generator/coreui/) Flask |
| 2 | + |
| 3 | +Open-source **Flask Dashboard** generated by `AppSeed` op top of an iconic design. For newcomers, **[CoreUI](https://appseed.us/generator/coreui/)** is one of the best open-source admin dashboard & control panel theme. Built on top of Bootstrap, `CoreUI` provides a range of responsive, reusable, and commonly used components. |
| 4 | + |
| 5 | +- 👉 [CoreUI Flask](https://appseed.us/product/coreui/flask/) - product page |
| 6 | +- 👉 [CoreUI Flask](https://coreui-flask.appseed-srv1.com/) - LIVE Deployment |
| 7 | + |
| 8 | +<br /> |
| 9 | + |
| 10 | +> Built with [CoreUI Generator](https://appseed.us/generator/coreui/) |
| 11 | +
|
| 12 | +- Timestamp: `2022-06-01 09:08` |
| 13 | +- Build ID: `6e2f2c1a-9b20-4bf8-8b7a-2d8717100cb0` |
| 14 | +- **Free [Support](https://appseed.us/support/)** (registered users) via `Email` and `Discord` |
| 15 | + |
| 16 | +<br /> |
| 17 | + |
| 18 | +> Features |
| 19 | +
|
| 20 | +- `Up-to-date dependencies` |
| 21 | +- Database: `mysql` |
| 22 | +- `DB Tools`: SQLAlchemy ORM, Flask-Migrate (schema migrations) |
| 23 | +- Session-Based authentication (via **flask_login**), Forms validation |
| 24 | + |
| 25 | +<br /> |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +<br /> |
| 30 | + |
| 31 | +## ✨ Start the app in Docker |
| 32 | + |
| 33 | +> **Step 1** - Download the code from the GH repository (using `GIT`) |
| 34 | +
|
| 35 | +```bash |
| 36 | +$ # Get the code |
| 37 | +$ git clone https://github.com/app-generator/flask-coreui.git |
| 38 | +$ cd flask-coreui |
| 39 | +``` |
| 40 | + |
| 41 | +<br /> |
| 42 | + |
| 43 | +> **Step 2** - Edit `.env` and set `DEBUG=True`. This will activate the `SQLite` persistance. |
| 44 | +
|
| 45 | +```txt |
| 46 | +DEBUG=True |
| 47 | +``` |
| 48 | + |
| 49 | +<br /> |
| 50 | + |
| 51 | +> **Step 3** - Start the APP in `Docker` |
| 52 | +
|
| 53 | +```bash |
| 54 | +$ docker-compose up --build |
| 55 | +``` |
| 56 | + |
| 57 | +Visit `http://localhost:5085` in your browser. The app should be up & running. |
| 58 | + |
| 59 | +<br /> |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +## ✨ Set up the MySql Database |
| 64 | + |
| 65 | +**Note:** Make sure your Mysql server is properly installed and accessible. |
| 66 | + |
| 67 | +> **Step 1** - Create the MySql Database to be used by the app |
| 68 | +
|
| 69 | +- `Create a new MySql` database |
| 70 | +- `Create a new user` and assign full privilegies (read/write) |
| 71 | + |
| 72 | +<br /> |
| 73 | + |
| 74 | +> **Step 2** - Edit the `.env` to match your MySql DB credentials. Make sure `DB_ENGINE` is set to `mysql`. |
| 75 | +
|
| 76 | +- `DB_ENGINE` : `mysql` |
| 77 | +- `DB_NAME` : default value = `appseed_db` |
| 78 | +- `DB_HOST` : default value = `localhost` |
| 79 | +- `DB_PORT` : default value = `3306` |
| 80 | +- `DB_USERNAME`: default value = `appseed_db_usr` |
| 81 | +- `DB_PASS` : default value = `pass` |
| 82 | + |
| 83 | +<br /> |
| 84 | + |
| 85 | +Here is a sample: |
| 86 | + |
| 87 | +```txt |
| 88 | +# .env sample |
| 89 | +
|
| 90 | +DEBUG=False # False enables the MySql Persistence |
| 91 | +
|
| 92 | +DB_ENGINE=mysql # Database Driver |
| 93 | +DB_NAME=appseed_flask # Database Name |
| 94 | +DB_USERNAME=appseed_flask_usr # Database User |
| 95 | +DB_PASS=STRONG_PASS_HERE # Password |
| 96 | +DB_HOST=localhost # Database HOST, default is localhost |
| 97 | +DB_PORT=3306 # MySql port, default = 3306 |
| 98 | +``` |
| 99 | + |
| 100 | +<br /> |
| 101 | + |
| 102 | + |
| 103 | +## ✨ How to use it |
| 104 | + |
| 105 | +> Download the code |
| 106 | +
|
| 107 | +```bash |
| 108 | +$ # Get the code |
| 109 | +$ git clone https://github.com/app-generator/flask-coreui.git |
| 110 | +$ cd flask-coreui |
| 111 | +``` |
| 112 | + |
| 113 | +<br /> |
| 114 | + |
| 115 | +### 👉 Set Up for `Unix`, `MacOS` |
| 116 | + |
| 117 | +> Install modules via `VENV` |
| 118 | +
|
| 119 | +```bash |
| 120 | +$ virtualenv env |
| 121 | +$ source env/bin/activate |
| 122 | +$ pip3 install -r requirements.txt |
| 123 | +``` |
| 124 | + |
| 125 | +<br /> |
| 126 | + |
| 127 | +> Set Up Flask Environment |
| 128 | +
|
| 129 | +```bash |
| 130 | +$ export FLASK_APP=run.py |
| 131 | +$ export FLASK_ENV=development |
| 132 | +``` |
| 133 | + |
| 134 | +<br /> |
| 135 | + |
| 136 | +> Start the app |
| 137 | +
|
| 138 | +```bash |
| 139 | +$ flask run |
| 140 | +``` |
| 141 | + |
| 142 | +At this point, the app runs at `http://127.0.0.1:5000/`. |
| 143 | + |
| 144 | +<br /> |
| 145 | + |
| 146 | +### 👉 Set Up for `Windows` |
| 147 | + |
| 148 | +> Install modules via `VENV` (windows) |
| 149 | +
|
| 150 | +``` |
| 151 | +$ virtualenv env |
| 152 | +$ .\env\Scripts\activate |
| 153 | +$ pip3 install -r requirements.txt |
| 154 | +``` |
| 155 | + |
| 156 | +<br /> |
| 157 | + |
| 158 | +> Set Up Flask Environment |
| 159 | +
|
| 160 | +```bash |
| 161 | +$ # CMD |
| 162 | +$ set FLASK_APP=run.py |
| 163 | +$ set FLASK_ENV=development |
| 164 | +$ |
| 165 | +$ # Powershell |
| 166 | +$ $env:FLASK_APP = ".\run.py" |
| 167 | +$ $env:FLASK_ENV = "development" |
| 168 | +``` |
| 169 | + |
| 170 | +<br /> |
| 171 | + |
| 172 | +> Start the app |
| 173 | +
|
| 174 | +```bash |
| 175 | +$ flask run |
| 176 | +``` |
| 177 | + |
| 178 | +At this point, the app runs at `http://127.0.0.1:5000/`. |
| 179 | + |
| 180 | +<br /> |
| 181 | + |
| 182 | +### 👉 Create Users |
| 183 | + |
| 184 | +By default, the app redirects guest users to authenticate. In order to access the private pages, follow this set up: |
| 185 | + |
| 186 | +- Start the app via `flask run` |
| 187 | +- Access the `registration` page and create a new user: |
| 188 | + - `http://127.0.0.1:5000/register` |
| 189 | +- Access the `sign in` page and authenticate |
| 190 | + - `http://127.0.0.1:5000/login` |
| 191 | + |
| 192 | +<br /> |
| 193 | + |
| 194 | +## ✨ Code-base structure |
| 195 | + |
| 196 | +The project is coded using blueprints, app factory pattern, dual configuration profile (development and production) and an intuitive structure presented bellow: |
| 197 | + |
| 198 | +```bash |
| 199 | +< PROJECT ROOT > |
| 200 | + | |
| 201 | + |-- apps/ |
| 202 | + | | |
| 203 | + | |-- home/ # A simple app that serve HTML files |
| 204 | + | | |-- routes.py # Define app routes |
| 205 | + | | |
| 206 | + | |-- authentication/ # Handles auth routes (login and register) |
| 207 | + | | |-- routes.py # Define authentication routes |
| 208 | + | | |-- models.py # Defines models |
| 209 | + | | |-- forms.py # Define auth forms (login and register) |
| 210 | + | | |
| 211 | + | |-- static/ |
| 212 | + | | |-- <css, JS, images> # CSS files, Javascripts files |
| 213 | + | | |
| 214 | + | |-- templates/ # Templates used to render pages |
| 215 | + | | |-- includes/ # HTML chunks and components |
| 216 | + | | | |-- navigation.html # Top menu component |
| 217 | + | | | |-- sidebar.html # Sidebar component |
| 218 | + | | | |-- footer.html # App Footer |
| 219 | + | | | |-- scripts.html # Scripts common to all pages |
| 220 | + | | | |
| 221 | + | | |-- layouts/ # Master pages |
| 222 | + | | | |-- base-fullscreen.html # Used by Authentication pages |
| 223 | + | | | |-- base.html # Used by common pages |
| 224 | + | | | |
| 225 | + | | |-- accounts/ # Authentication pages |
| 226 | + | | | |-- login.html # Login page |
| 227 | + | | | |-- register.html # Register page |
| 228 | + | | | |
| 229 | + | | |-- home/ # UI Kit Pages |
| 230 | + | | |-- index.html # Index page |
| 231 | + | | |-- 404-page.html # 404 page |
| 232 | + | | |-- *.html # All other pages |
| 233 | + | | |
| 234 | + | config.py # Set up the app |
| 235 | + | __init__.py # Initialize the app |
| 236 | + | |
| 237 | + |-- requirements.txt # App Dependencies |
| 238 | + | |
| 239 | + |-- .env # Inject Configuration via Environment |
| 240 | + |-- run.py # Start the app - WSGI gateway |
| 241 | + | |
| 242 | + |-- ************************************************************************ |
| 243 | +``` |
| 244 | + |
| 245 | +<br /> |
| 246 | + |
| 247 | +## ✨ PRO Version |
| 248 | + |
| 249 | +> For more components, pages and priority on support, feel free to take a look at this amazing starter: |
| 250 | +
|
| 251 | +Soft UI Dashboard is a premium Bootstrap 5 Design now available for download in Flask. Made of hundred of elements, designed blocks, and fully coded pages, Soft UI Dashboard PRO is ready to help you create stunning websites and web apps. |
| 252 | + |
| 253 | +- 👉 [Soft UI Dashboard PRO Flask](https://appseed.us/product/soft-ui-dashboard-pro/flask/) - Product Page |
| 254 | +- 👉 [Soft UI Dashboard PRO Flask](https://flask-soft-ui-dashboard-pro.appseed-srv1.com/) - LIVE Demo |
| 255 | + |
| 256 | +<br > |
| 257 | + |
| 258 | + |
| 259 | + |
| 260 | +<br /> |
| 261 | + |
| 262 | +--- |
| 263 | +[CoreUI](https://appseed.us/generator/coreui/) Flask - Open-source starter generated by **[AppSeed Generator](https://appseed.us/generator/)**. |
0 commit comments