FlaskSpark 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. flaskspark-0.1.0/FlaskSpark.egg-info/PKG-INFO +188 -0
  2. flaskspark-0.1.0/FlaskSpark.egg-info/SOURCES.txt +45 -0
  3. flaskspark-0.1.0/FlaskSpark.egg-info/dependency_links.txt +1 -0
  4. flaskspark-0.1.0/FlaskSpark.egg-info/requires.txt +13 -0
  5. flaskspark-0.1.0/FlaskSpark.egg-info/top_level.txt +1 -0
  6. flaskspark-0.1.0/LICENSE +21 -0
  7. flaskspark-0.1.0/PKG-INFO +188 -0
  8. flaskspark-0.1.0/README.md +143 -0
  9. flaskspark-0.1.0/flaskspark/__init__.py +8 -0
  10. flaskspark-0.1.0/flaskspark/app.py +706 -0
  11. flaskspark-0.1.0/flaskspark/config.py +113 -0
  12. flaskspark-0.1.0/flaskspark/exceptions/__init__.py +9 -0
  13. flaskspark-0.1.0/flaskspark/exceptions/database_connection_error.py +15 -0
  14. flaskspark-0.1.0/flaskspark/exceptions/database_incomplete_error.py +34 -0
  15. flaskspark-0.1.0/flaskspark/helpers/login_provider.py +64 -0
  16. flaskspark-0.1.0/flaskspark/helpers/login_provider_default.py +35 -0
  17. flaskspark-0.1.0/flaskspark/helpers/login_provider_oauth.py +247 -0
  18. flaskspark-0.1.0/flaskspark/helpers/user_utilities.py +5 -0
  19. flaskspark-0.1.0/flaskspark/models/role.py +104 -0
  20. flaskspark-0.1.0/flaskspark/models/user.py +122 -0
  21. flaskspark-0.1.0/flaskspark/static/images/favicon/android-chrome-192x192.png +0 -0
  22. flaskspark-0.1.0/flaskspark/static/images/favicon/android-chrome-512x512.png +0 -0
  23. flaskspark-0.1.0/flaskspark/static/images/favicon/apple-touch-icon.png +0 -0
  24. flaskspark-0.1.0/flaskspark/static/images/favicon/favicon-16x16.png +0 -0
  25. flaskspark-0.1.0/flaskspark/static/images/favicon/favicon-32x32.png +0 -0
  26. flaskspark-0.1.0/flaskspark/static/images/favicon/favicon.ico +0 -0
  27. flaskspark-0.1.0/flaskspark/static/images/favicon/site.webmanifest +11 -0
  28. flaskspark-0.1.0/flaskspark/static/scripts/app.js +9 -0
  29. flaskspark-0.1.0/flaskspark/static/scripts/webpack.js +1 -0
  30. flaskspark-0.1.0/flaskspark/static/scss/app.scss +62 -0
  31. flaskspark-0.1.0/flaskspark/static/scss/maps.scss +0 -0
  32. flaskspark-0.1.0/flaskspark/static/scss/styles.scss +0 -0
  33. flaskspark-0.1.0/flaskspark/static/scss/variables.scss +0 -0
  34. flaskspark-0.1.0/flaskspark/templates/base.html +41 -0
  35. flaskspark-0.1.0/flaskspark/templates/layouts/default.html +7 -0
  36. flaskspark-0.1.0/flaskspark/templates/layouts/detached.html +7 -0
  37. flaskspark-0.1.0/flaskspark/templates/layouts/horizontal.html +7 -0
  38. flaskspark-0.1.0/flaskspark/templates/partials/footer.html +0 -0
  39. flaskspark-0.1.0/flaskspark/templates/partials/navigation-main.html +0 -0
  40. flaskspark-0.1.0/flaskspark/templates/partials/navigation-user.html +0 -0
  41. flaskspark-0.1.0/flaskspark/templates/partials/sidebar.html +0 -0
  42. flaskspark-0.1.0/flaskspark/templates/views/main/get.html +9 -0
  43. flaskspark-0.1.0/flaskspark/views/__init__.py +1 -0
  44. flaskspark-0.1.0/flaskspark/views/flaskspark_method_view.py +63 -0
  45. flaskspark-0.1.0/flaskspark/views/main.py +25 -0
  46. flaskspark-0.1.0/pyproject.toml +41 -0
  47. flaskspark-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,188 @@
1
+ Metadata-Version: 2.4
2
+ Name: FlaskSpark
3
+ Version: 0.1.0
4
+ Summary: FlaskSpark is a lightweight and customizable Flask boilerplate designed to ignite your web application development process.
5
+ Author: berofa
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 berofa
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: authlib
32
+ Requires-Dist: flask>=2.0
33
+ Requires-Dist: flask-assets
34
+ Requires-Dist: flask-babel
35
+ Requires-Dist: flask-login
36
+ Requires-Dist: flask-migrate
37
+ Requires-Dist: flask-session
38
+ Requires-Dist: flask-sqlalchemy
39
+ Requires-Dist: libsass
40
+ Requires-Dist: python-dotenv
41
+ Requires-Dist: rcssmin
42
+ Requires-Dist: requests
43
+ Requires-Dist: rjsmin
44
+ Dynamic: license-file
45
+
46
+ # FlaskSpark
47
+
48
+ FlaskSpark is a lightweight Flask framework with a clear project structure, automatic class-based view registration, built-in SQLAlchemy + Flask-Migrate wiring, optional OAuth/OIDC login, and an asset pipeline for SCSS/JS.
49
+
50
+ ## Features
51
+ - App bootstrap with configurable `app_module`
52
+ - Auto-registration of class-based views (`as_view()`)
53
+ - SQLAlchemy + Flask-Migrate integration
54
+ - Pluggable login providers (`Default`, `OAuth`)
55
+ - OAuth/OIDC support via `authlib`
56
+ - Built-in i18n with Flask-Babel
57
+ - Static/template fallback (app first, FlaskSpark second)
58
+ - Optional SCSS/JS bundling via Flask-Assets
59
+
60
+ ## Requirements
61
+ - Python 3.8+
62
+ - pip
63
+
64
+ ## Installation
65
+ ```bash
66
+ pip install FlaskSpark
67
+ ```
68
+
69
+ Development (editable):
70
+ ```bash
71
+ pip install -e .
72
+ ```
73
+
74
+ ## Quick Start
75
+ ```python
76
+ from flaskspark import FlaskSpark
77
+
78
+ app = FlaskSpark(
79
+ app_module="app",
80
+ config={
81
+ "SECRET_KEY": "change-me",
82
+ "SQLALCHEMY_DATABASE_URI": "sqlite:///instance/app.db",
83
+ "BABEL_SUPPORTED_LOCALES": ["en", "de"],
84
+ },
85
+ ).app
86
+ ```
87
+
88
+ Expected app layout:
89
+ ```text
90
+ app/
91
+ __init__.py
92
+ views/
93
+ home.py
94
+ models/
95
+ __init__.py
96
+ templates/
97
+ static/
98
+ ```
99
+
100
+ ## Class-Based Views
101
+ Any class in `app.views` implementing `as_view()` is auto-registered.
102
+
103
+ ```python
104
+ from flaskspark.views.flaskspark_method_view import FlaskSparkMethodView
105
+ from flask import render_template
106
+
107
+ class HomeView(FlaskSparkMethodView):
108
+ url = "/"
109
+ endpoint = "home"
110
+
111
+ def get(self):
112
+ return render_template("index.html")
113
+ ```
114
+
115
+ ## OAuth (OIDC) Login Provider
116
+ Enable OAuth provider:
117
+ ```python
118
+ FlaskSpark(login_provider="OAuth")
119
+ ```
120
+
121
+ Required config:
122
+ ```text
123
+ OAUTH_NAME
124
+ OAUTH_AUTHORIZE_URL
125
+ OAUTH_ACCESS_TOKEN_URL
126
+ OAUTH_USERINFO_ENDPOINT
127
+ OAUTH_JWKS_URI
128
+ OAUTH_CLIENT_ID
129
+ OAUTH_CLIENT_SECRET
130
+ OAUTH_SCOPE
131
+ ```
132
+
133
+ Optional role mapping:
134
+ ```text
135
+ OAUTH_GROUPS_CLAIM=groups
136
+ OAUTH_ROLE_PRIORITY=admins,editors,users
137
+ OAUTH_ROLE_MAP=admins:Administrators,editors:Editors,users:Users
138
+ ```
139
+
140
+ ## Database & Migrations
141
+ ```bash
142
+ FLASK_APP=app.py python -m flask db init
143
+ FLASK_APP=app.py python -m flask db migrate -m "init"
144
+ FLASK_APP=app.py python -m flask db upgrade
145
+ ```
146
+
147
+ ## Assets (SCSS / JS)
148
+ FlaskSpark can build SCSS and JS bundles:
149
+
150
+ ```python
151
+ FlaskSpark(
152
+ app_module="app",
153
+ config={
154
+ "ASSETS_ENABLE": True,
155
+ "ASSETS_AUTO_BUILD": True,
156
+ "ASSETS_BUNDLES": [
157
+ {
158
+ "name": "dashboard_js",
159
+ "type": "js",
160
+ "entry": "js/dashboard.js",
161
+ "output": "scripts/dashboard.min.js",
162
+ "filters": "rjsmin",
163
+ },
164
+ ],
165
+ },
166
+ )
167
+ ```
168
+
169
+ ## i18n
170
+ FlaskSpark initializes Babel and provides a client-side translation endpoint:
171
+
172
+ ```text
173
+ GET /_flaskspark/i18n?keys=Key%201,Key%202
174
+ ```
175
+
176
+ ## Configuration
177
+ Common keys:
178
+ ```python
179
+ SECRET_KEY = "..."
180
+ SQLALCHEMY_DATABASE_URI = "sqlite:///instance/app.db"
181
+ APP_BIND_HOST = "0.0.0.0"
182
+ APP_PORT = 5067
183
+ BABEL_DEFAULT_LOCALE = "en"
184
+ BABEL_SUPPORTED_LOCALES = ["en", "de"]
185
+ ```
186
+
187
+ ## License
188
+ MIT License. See `LICENSE`.
@@ -0,0 +1,45 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ FlaskSpark.egg-info/PKG-INFO
5
+ FlaskSpark.egg-info/SOURCES.txt
6
+ FlaskSpark.egg-info/dependency_links.txt
7
+ FlaskSpark.egg-info/requires.txt
8
+ FlaskSpark.egg-info/top_level.txt
9
+ flaskspark/__init__.py
10
+ flaskspark/app.py
11
+ flaskspark/config.py
12
+ flaskspark/exceptions/__init__.py
13
+ flaskspark/exceptions/database_connection_error.py
14
+ flaskspark/exceptions/database_incomplete_error.py
15
+ flaskspark/helpers/login_provider.py
16
+ flaskspark/helpers/login_provider_default.py
17
+ flaskspark/helpers/login_provider_oauth.py
18
+ flaskspark/helpers/user_utilities.py
19
+ flaskspark/models/role.py
20
+ flaskspark/models/user.py
21
+ flaskspark/static/images/favicon/android-chrome-192x192.png
22
+ flaskspark/static/images/favicon/android-chrome-512x512.png
23
+ flaskspark/static/images/favicon/apple-touch-icon.png
24
+ flaskspark/static/images/favicon/favicon-16x16.png
25
+ flaskspark/static/images/favicon/favicon-32x32.png
26
+ flaskspark/static/images/favicon/favicon.ico
27
+ flaskspark/static/images/favicon/site.webmanifest
28
+ flaskspark/static/scripts/app.js
29
+ flaskspark/static/scripts/webpack.js
30
+ flaskspark/static/scss/app.scss
31
+ flaskspark/static/scss/maps.scss
32
+ flaskspark/static/scss/styles.scss
33
+ flaskspark/static/scss/variables.scss
34
+ flaskspark/templates/base.html
35
+ flaskspark/templates/layouts/default.html
36
+ flaskspark/templates/layouts/detached.html
37
+ flaskspark/templates/layouts/horizontal.html
38
+ flaskspark/templates/partials/footer.html
39
+ flaskspark/templates/partials/navigation-main.html
40
+ flaskspark/templates/partials/navigation-user.html
41
+ flaskspark/templates/partials/sidebar.html
42
+ flaskspark/templates/views/main/get.html
43
+ flaskspark/views/__init__.py
44
+ flaskspark/views/flaskspark_method_view.py
45
+ flaskspark/views/main.py
@@ -0,0 +1,13 @@
1
+ authlib
2
+ flask>=2.0
3
+ flask-assets
4
+ flask-babel
5
+ flask-login
6
+ flask-migrate
7
+ flask-session
8
+ flask-sqlalchemy
9
+ libsass
10
+ python-dotenv
11
+ rcssmin
12
+ requests
13
+ rjsmin
@@ -0,0 +1 @@
1
+ flaskspark
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 berofa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,188 @@
1
+ Metadata-Version: 2.4
2
+ Name: FlaskSpark
3
+ Version: 0.1.0
4
+ Summary: FlaskSpark is a lightweight and customizable Flask boilerplate designed to ignite your web application development process.
5
+ Author: berofa
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 berofa
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: authlib
32
+ Requires-Dist: flask>=2.0
33
+ Requires-Dist: flask-assets
34
+ Requires-Dist: flask-babel
35
+ Requires-Dist: flask-login
36
+ Requires-Dist: flask-migrate
37
+ Requires-Dist: flask-session
38
+ Requires-Dist: flask-sqlalchemy
39
+ Requires-Dist: libsass
40
+ Requires-Dist: python-dotenv
41
+ Requires-Dist: rcssmin
42
+ Requires-Dist: requests
43
+ Requires-Dist: rjsmin
44
+ Dynamic: license-file
45
+
46
+ # FlaskSpark
47
+
48
+ FlaskSpark is a lightweight Flask framework with a clear project structure, automatic class-based view registration, built-in SQLAlchemy + Flask-Migrate wiring, optional OAuth/OIDC login, and an asset pipeline for SCSS/JS.
49
+
50
+ ## Features
51
+ - App bootstrap with configurable `app_module`
52
+ - Auto-registration of class-based views (`as_view()`)
53
+ - SQLAlchemy + Flask-Migrate integration
54
+ - Pluggable login providers (`Default`, `OAuth`)
55
+ - OAuth/OIDC support via `authlib`
56
+ - Built-in i18n with Flask-Babel
57
+ - Static/template fallback (app first, FlaskSpark second)
58
+ - Optional SCSS/JS bundling via Flask-Assets
59
+
60
+ ## Requirements
61
+ - Python 3.8+
62
+ - pip
63
+
64
+ ## Installation
65
+ ```bash
66
+ pip install FlaskSpark
67
+ ```
68
+
69
+ Development (editable):
70
+ ```bash
71
+ pip install -e .
72
+ ```
73
+
74
+ ## Quick Start
75
+ ```python
76
+ from flaskspark import FlaskSpark
77
+
78
+ app = FlaskSpark(
79
+ app_module="app",
80
+ config={
81
+ "SECRET_KEY": "change-me",
82
+ "SQLALCHEMY_DATABASE_URI": "sqlite:///instance/app.db",
83
+ "BABEL_SUPPORTED_LOCALES": ["en", "de"],
84
+ },
85
+ ).app
86
+ ```
87
+
88
+ Expected app layout:
89
+ ```text
90
+ app/
91
+ __init__.py
92
+ views/
93
+ home.py
94
+ models/
95
+ __init__.py
96
+ templates/
97
+ static/
98
+ ```
99
+
100
+ ## Class-Based Views
101
+ Any class in `app.views` implementing `as_view()` is auto-registered.
102
+
103
+ ```python
104
+ from flaskspark.views.flaskspark_method_view import FlaskSparkMethodView
105
+ from flask import render_template
106
+
107
+ class HomeView(FlaskSparkMethodView):
108
+ url = "/"
109
+ endpoint = "home"
110
+
111
+ def get(self):
112
+ return render_template("index.html")
113
+ ```
114
+
115
+ ## OAuth (OIDC) Login Provider
116
+ Enable OAuth provider:
117
+ ```python
118
+ FlaskSpark(login_provider="OAuth")
119
+ ```
120
+
121
+ Required config:
122
+ ```text
123
+ OAUTH_NAME
124
+ OAUTH_AUTHORIZE_URL
125
+ OAUTH_ACCESS_TOKEN_URL
126
+ OAUTH_USERINFO_ENDPOINT
127
+ OAUTH_JWKS_URI
128
+ OAUTH_CLIENT_ID
129
+ OAUTH_CLIENT_SECRET
130
+ OAUTH_SCOPE
131
+ ```
132
+
133
+ Optional role mapping:
134
+ ```text
135
+ OAUTH_GROUPS_CLAIM=groups
136
+ OAUTH_ROLE_PRIORITY=admins,editors,users
137
+ OAUTH_ROLE_MAP=admins:Administrators,editors:Editors,users:Users
138
+ ```
139
+
140
+ ## Database & Migrations
141
+ ```bash
142
+ FLASK_APP=app.py python -m flask db init
143
+ FLASK_APP=app.py python -m flask db migrate -m "init"
144
+ FLASK_APP=app.py python -m flask db upgrade
145
+ ```
146
+
147
+ ## Assets (SCSS / JS)
148
+ FlaskSpark can build SCSS and JS bundles:
149
+
150
+ ```python
151
+ FlaskSpark(
152
+ app_module="app",
153
+ config={
154
+ "ASSETS_ENABLE": True,
155
+ "ASSETS_AUTO_BUILD": True,
156
+ "ASSETS_BUNDLES": [
157
+ {
158
+ "name": "dashboard_js",
159
+ "type": "js",
160
+ "entry": "js/dashboard.js",
161
+ "output": "scripts/dashboard.min.js",
162
+ "filters": "rjsmin",
163
+ },
164
+ ],
165
+ },
166
+ )
167
+ ```
168
+
169
+ ## i18n
170
+ FlaskSpark initializes Babel and provides a client-side translation endpoint:
171
+
172
+ ```text
173
+ GET /_flaskspark/i18n?keys=Key%201,Key%202
174
+ ```
175
+
176
+ ## Configuration
177
+ Common keys:
178
+ ```python
179
+ SECRET_KEY = "..."
180
+ SQLALCHEMY_DATABASE_URI = "sqlite:///instance/app.db"
181
+ APP_BIND_HOST = "0.0.0.0"
182
+ APP_PORT = 5067
183
+ BABEL_DEFAULT_LOCALE = "en"
184
+ BABEL_SUPPORTED_LOCALES = ["en", "de"]
185
+ ```
186
+
187
+ ## License
188
+ MIT License. See `LICENSE`.
@@ -0,0 +1,143 @@
1
+ # FlaskSpark
2
+
3
+ FlaskSpark is a lightweight Flask framework with a clear project structure, automatic class-based view registration, built-in SQLAlchemy + Flask-Migrate wiring, optional OAuth/OIDC login, and an asset pipeline for SCSS/JS.
4
+
5
+ ## Features
6
+ - App bootstrap with configurable `app_module`
7
+ - Auto-registration of class-based views (`as_view()`)
8
+ - SQLAlchemy + Flask-Migrate integration
9
+ - Pluggable login providers (`Default`, `OAuth`)
10
+ - OAuth/OIDC support via `authlib`
11
+ - Built-in i18n with Flask-Babel
12
+ - Static/template fallback (app first, FlaskSpark second)
13
+ - Optional SCSS/JS bundling via Flask-Assets
14
+
15
+ ## Requirements
16
+ - Python 3.8+
17
+ - pip
18
+
19
+ ## Installation
20
+ ```bash
21
+ pip install FlaskSpark
22
+ ```
23
+
24
+ Development (editable):
25
+ ```bash
26
+ pip install -e .
27
+ ```
28
+
29
+ ## Quick Start
30
+ ```python
31
+ from flaskspark import FlaskSpark
32
+
33
+ app = FlaskSpark(
34
+ app_module="app",
35
+ config={
36
+ "SECRET_KEY": "change-me",
37
+ "SQLALCHEMY_DATABASE_URI": "sqlite:///instance/app.db",
38
+ "BABEL_SUPPORTED_LOCALES": ["en", "de"],
39
+ },
40
+ ).app
41
+ ```
42
+
43
+ Expected app layout:
44
+ ```text
45
+ app/
46
+ __init__.py
47
+ views/
48
+ home.py
49
+ models/
50
+ __init__.py
51
+ templates/
52
+ static/
53
+ ```
54
+
55
+ ## Class-Based Views
56
+ Any class in `app.views` implementing `as_view()` is auto-registered.
57
+
58
+ ```python
59
+ from flaskspark.views.flaskspark_method_view import FlaskSparkMethodView
60
+ from flask import render_template
61
+
62
+ class HomeView(FlaskSparkMethodView):
63
+ url = "/"
64
+ endpoint = "home"
65
+
66
+ def get(self):
67
+ return render_template("index.html")
68
+ ```
69
+
70
+ ## OAuth (OIDC) Login Provider
71
+ Enable OAuth provider:
72
+ ```python
73
+ FlaskSpark(login_provider="OAuth")
74
+ ```
75
+
76
+ Required config:
77
+ ```text
78
+ OAUTH_NAME
79
+ OAUTH_AUTHORIZE_URL
80
+ OAUTH_ACCESS_TOKEN_URL
81
+ OAUTH_USERINFO_ENDPOINT
82
+ OAUTH_JWKS_URI
83
+ OAUTH_CLIENT_ID
84
+ OAUTH_CLIENT_SECRET
85
+ OAUTH_SCOPE
86
+ ```
87
+
88
+ Optional role mapping:
89
+ ```text
90
+ OAUTH_GROUPS_CLAIM=groups
91
+ OAUTH_ROLE_PRIORITY=admins,editors,users
92
+ OAUTH_ROLE_MAP=admins:Administrators,editors:Editors,users:Users
93
+ ```
94
+
95
+ ## Database & Migrations
96
+ ```bash
97
+ FLASK_APP=app.py python -m flask db init
98
+ FLASK_APP=app.py python -m flask db migrate -m "init"
99
+ FLASK_APP=app.py python -m flask db upgrade
100
+ ```
101
+
102
+ ## Assets (SCSS / JS)
103
+ FlaskSpark can build SCSS and JS bundles:
104
+
105
+ ```python
106
+ FlaskSpark(
107
+ app_module="app",
108
+ config={
109
+ "ASSETS_ENABLE": True,
110
+ "ASSETS_AUTO_BUILD": True,
111
+ "ASSETS_BUNDLES": [
112
+ {
113
+ "name": "dashboard_js",
114
+ "type": "js",
115
+ "entry": "js/dashboard.js",
116
+ "output": "scripts/dashboard.min.js",
117
+ "filters": "rjsmin",
118
+ },
119
+ ],
120
+ },
121
+ )
122
+ ```
123
+
124
+ ## i18n
125
+ FlaskSpark initializes Babel and provides a client-side translation endpoint:
126
+
127
+ ```text
128
+ GET /_flaskspark/i18n?keys=Key%201,Key%202
129
+ ```
130
+
131
+ ## Configuration
132
+ Common keys:
133
+ ```python
134
+ SECRET_KEY = "..."
135
+ SQLALCHEMY_DATABASE_URI = "sqlite:///instance/app.db"
136
+ APP_BIND_HOST = "0.0.0.0"
137
+ APP_PORT = 5067
138
+ BABEL_DEFAULT_LOCALE = "en"
139
+ BABEL_SUPPORTED_LOCALES = ["en", "de"]
140
+ ```
141
+
142
+ ## License
143
+ MIT License. See `LICENSE`.
@@ -0,0 +1,8 @@
1
+ """
2
+ Initialization for the FlaskSpark package.
3
+ """
4
+
5
+ from .app import FlaskSpark, db, migrate, login_manager
6
+
7
+ # Export key symbols for convenience.
8
+ __all__ = ["FlaskSpark", "db", "migrate", "login_manager"]