minimal flask boilerplate for security/user/login with factory pattern, browser-sync, flowbite/tailwind (dark-/light-theme).
- add htmx
python -m venv venv&venv\Scripts\activatenpm ipip install -r requirements.txt- adjust
config.pyif needed (e.g. database swap) - adjust
.envif needed - adjust
bs-config.pyif needed
npm run serverbsto start browser-syncnpx tailwindcss -i ./app/static/src/input.scss -o ./app/static/dist/css/output.css --watchto start css watchpython run.pyto run app- one-time/optional:
python setup.pyto create db - check sqlite db:
sqlite3 instance/boilerplate.db=>select * from user;,.tables,.databases,.show
/index,/as default home route/loginprovided by flask-security-too/registerprovided by flask-security-too/usersroute to show users (login + role=admin required)- custom
/securitytemplates forlogin_user.htmlandregister_user.html - default example models/db-structure for
user,roleandroles_users
| id | username | password | active | confirmed_at | current_login_at | last_login_at | current_login_ip | last_login_ip | login_count | fs_uniquifier_placeholder | |
|---|---|---|---|---|---|---|---|---|---|---|---|
- factory pattern:
run.py=>factory.py=>routes,extensions,models,security - app structure:
└───root
│ run.py
│ setup.py
│ config.py
│ .env
│ package.json
│ requirements.txt
│ tailwind.config.js
│ bs-config.py
|
├─── instance
└─── sqlite.db
|
├─── app
│ factory.py
│ routes.py
│ extensions.py
│ models.py
│ security.py
|
├───templates
│ base.html
│ index.html
│ users.html
│ macros.html
│
└─── security
│ login_user.html
│ register_user.html
│ macros.html
|
└─── static
│ theme.js
│ logo.png
│
└─── src
| input.scss
| custom.scss
|- lask-security-too =>
- npm
- flowbite, theme-mode, tailwind css
- browser-sync, bs-config.js
- adjust/rename .env.example
- ...git