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
5327cca1
Commit
5327cca1
authored
2 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Move logging and sentry SDK initialization
parent
2781f336
No related branches found
No related tags found
1 merge request
!44
Feature/comp 208 google o auth poc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
compendium_v2/__init__.py
+12
-0
12 additions, 0 deletions
compendium_v2/__init__.py
compendium_v2/app.py
+0
-2
0 additions, 2 deletions
compendium_v2/app.py
compendium_v2/environment.py
+1
-12
1 addition, 12 deletions
compendium_v2/environment.py
with
13 additions
and
14 deletions
compendium_v2/__init__.py
+
12
−
0
View file @
5327cca1
...
@@ -4,6 +4,10 @@ automatically invoked app factory
...
@@ -4,6 +4,10 @@ automatically invoked app factory
import
logging
import
logging
import
os
import
os
import
pkg_resources
import
sentry_sdk
from
sentry_sdk.integrations.flask
import
FlaskIntegration
from
flask
import
Flask
from
flask
import
Flask
from
flask_cors
import
CORS
# for debugging
from
flask_cors
import
CORS
# for debugging
# the currently available stubs for flask_migrate are old (they depend on sqlalchemy 1.4 types)
# the currently available stubs for flask_migrate are old (they depend on sqlalchemy 1.4 types)
...
@@ -11,6 +15,14 @@ from flask_migrate import Migrate, upgrade # type: ignore
...
@@ -11,6 +15,14 @@ from flask_migrate import Migrate, upgrade # type: ignore
from
compendium_v2
import
config
,
environment
from
compendium_v2
import
config
,
environment
from
compendium_v2.db
import
db
from
compendium_v2.db
import
db
sentry_dsn
=
os
.
getenv
(
'
SENTRY_DSN
'
)
if
sentry_dsn
:
sentry_sdk
.
init
(
dsn
=
sentry_dsn
,
integrations
=
[
FlaskIntegration
()],
release
=
pkg_resources
.
get_distribution
(
'
compendium-v2
'
).
version
)
environment
.
setup_logging
()
def
_create_app
(
app_config
)
->
Flask
:
def
_create_app
(
app_config
)
->
Flask
:
...
...
This diff is collapsed.
Click to expand it.
compendium_v2/app.py
+
0
−
2
View file @
5327cca1
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
default app creation
default app creation
"""
"""
import
compendium_v2
import
compendium_v2
from
compendium_v2
import
environment
environment
.
setup_logging
()
app
=
compendium_v2
.
create_app
()
app
=
compendium_v2
.
create_app
()
...
...
This diff is collapsed.
Click to expand it.
compendium_v2/environment.py
+
1
−
12
View file @
5327cca1
import
json
import
json
import
logging.config
import
logging.config
import
os
import
os
import
pkg_resources
import
sentry_sdk
from
sentry_sdk.integrations.flask
import
FlaskIntegration
LOGGING_DEFAULT_CONFIG
=
{
LOGGING_DEFAULT_CONFIG
=
{
'
version
'
:
1
,
'
version
'
:
1
,
...
@@ -21,7 +17,7 @@ LOGGING_DEFAULT_CONFIG = {
...
@@ -21,7 +17,7 @@ LOGGING_DEFAULT_CONFIG = {
'
level
'
:
'
DEBUG
'
,
'
level
'
:
'
DEBUG
'
,
'
formatter
'
:
'
simple
'
,
'
formatter
'
:
'
simple
'
,
'
stream
'
:
'
ext://sys.stdout
'
'
stream
'
:
'
ext://sys.stdout
'
}
}
,
},
},
...
@@ -53,11 +49,4 @@ def setup_logging():
...
@@ -53,11 +49,4 @@ def setup_logging():
with
open
(
filename
)
as
f
:
with
open
(
filename
)
as
f
:
logging_config
=
json
.
loads
(
f
.
read
())
logging_config
=
json
.
loads
(
f
.
read
())
sentry_dsn
=
os
.
getenv
(
'
SENTRY_DSN
'
)
if
sentry_dsn
:
sentry_sdk
.
init
(
dsn
=
sentry_dsn
,
integrations
=
[
FlaskIntegration
()],
release
=
pkg_resources
.
get_distribution
(
'
compendium-v2
'
).
version
)
logging
.
config
.
dictConfig
(
logging_config
)
logging
.
config
.
dictConfig
(
logging_config
)
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