Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
compendium-v2
Commits
6bef7e61
Commit
6bef7e61
authored
2 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/better_sphinx' into 'develop'
improve sphinx call to _create_app See merge request
!50
parents
7145b226
48fd2f70
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!50
improve sphinx call to _create_app
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
compendium_v2/__init__.py
+10
-14
10 additions, 14 deletions
compendium_v2/__init__.py
docs/source/api.rst
+2
-2
2 additions, 2 deletions
docs/source/api.rst
tox.ini
+1
-1
1 addition, 1 deletion
tox.ini
with
13 additions
and
17 deletions
compendium_v2/__init__.py
+
10
−
14
View file @
6bef7e61
...
...
@@ -32,7 +32,7 @@ environment.setup_logging()
logger
=
logging
.
getLogger
(
__name__
)
def
_create_app
(
app_config
)
->
Flask
:
def
_create_app
()
->
Flask
:
# used by sphinx to create documentation without config and db migrations
app
=
Flask
(
__name__
)
CORS
(
app
)
...
...
@@ -46,11 +46,13 @@ def _create_app(app_config) -> Flask:
from
compendium_v2.routes
import
api
app
.
register_blueprint
(
api
.
routes
,
url_prefix
=
'
/api
'
)
if
not
app_config
:
# workaround for sphinx causing app to be created, but not loading a config
return
app
return
app
def
_create_app_with_db
(
app_config
)
->
Flask
:
# used by the tests and the publishers
app
=
_create_app
()
app
.
config
[
'
CONFIG_PARAMS
'
]
=
app_config
app
.
config
[
'
SECRET_KEY
'
]
=
app_config
[
'
SECRET_KEY
'
]
app
.
config
[
'
SESSION_COOKIE_SECURE
'
]
=
True
if
'
oidc
'
not
in
app_config
:
...
...
@@ -59,17 +61,11 @@ def _create_app(app_config) -> Flask:
else
:
logger
.
info
(
'
OIDC configuration found, authentication will be enabled
'
)
return
app
def
_create_app_with_db
(
app_config
)
->
Flask
:
# used by the tests and the publishers
app
=
_create_app
(
app_config
)
app
.
config
[
'
SQLALCHEMY_DATABASE_URI
'
]
=
app
.
config
[
'
CONFIG_PARAMS
'
][
'
SQLALCHEMY_DATABASE_URI
'
]
app
.
config
[
'
SQLALCHEMY_DATABASE_URI
'
]
=
app_config
[
'
SQLALCHEMY_DATABASE_URI
'
]
if
'
SQLALCHEMY_BINDS
'
in
app
.
config
[
'
CONFIG_PARAMS
'
]
:
if
'
SQLALCHEMY_BINDS
'
in
app
_
config
:
# for the publishers
app
.
config
[
'
SQLALCHEMY_BINDS
'
]
=
app
.
config
[
'
CONFIG_PARAMS
'
][
'
SQLALCHEMY_BINDS
'
]
app
.
config
[
'
SQLALCHEMY_BINDS
'
]
=
app
_
config
[
'
SQLALCHEMY_BINDS
'
]
db
.
init_app
(
app
)
return
app
...
...
This diff is collapsed.
Click to expand it.
docs/source/api.rst
+
2
−
2
View file @
6bef7e61
...
...
@@ -9,8 +9,8 @@ Responses to valid requests are returned as JSON messages.
The server will therefore return an error unless
`application/json` is in the `Accept` request header field.
.. qrefflask:: compendium_v2:_create_app(
None
)
.. qrefflask:: compendium_v2:_create_app()
:autoquickref:
.. autoflask:: compendium_v2:_create_app(
None
)
.. autoflask:: compendium_v2:_create_app()
:undoc-static:
This diff is collapsed.
Click to expand it.
tox.ini
+
1
−
1
View file @
6bef7e61
...
...
@@ -22,5 +22,5 @@ commands =
coverage
report
--fail-under
80
flake8
mypy
{toxinidir}/compendium_v2/
{toxinidir}/test/
sphinx-build
-M
html
docs/source
docs/build
sphinx-build
-M
html
docs/source
docs/build
-E
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment