Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fractalis
Manage
Activity
Members
Labels
Plan
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
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
Fractalis
fractalis
Commits
0ea49063
There was a problem fetching the pipeline metadata.
Commit
0ea49063
authored
8 years ago
by
Sascha Herzinger
Browse files
Options
Downloads
Patches
Plain Diff
docstrings ftw
parent
4eccbb8b
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fractalis/__init__.py
+5
-0
5 additions, 0 deletions
fractalis/__init__.py
fractalis/config.py
+23
-1
23 additions, 1 deletion
fractalis/config.py
with
28 additions
and
1 deletion
fractalis/__init__.py
+
5
−
0
View file @
0ea49063
"""
Initalize Fractalis Flask app and configure it.
Modules in this package:
- config -- Manages Fractalis Flask app configuration
"""
from
flask
import
Flask
from
fractalis.config
import
configure_app
...
...
This diff is collapsed.
Click to expand it.
fractalis/config.py
+
23
−
1
View file @
0ea49063
"""
This module manages the configuration of the Fractalis flask app.
Exports:
- configure_app -- Function that configures given Flask app
"""
import
os
class
BaseConfig
():
class
BaseConfig
(
object
):
"""
Basic configuration that should be used in production.
"""
DEBUG
=
False
TESTING
=
False
class
DevelopmentConfig
(
BaseConfig
):
"""
Configuration used in development.
"""
DEBUG
=
True
TESTING
=
False
class
TestingConfig
(
BaseConfig
):
"""
Configuration used in testing.
"""
DEBUG
=
False
TESTING
=
True
config
=
{
'
development
'
:
'
fractalis.config.DevelopmentConfig
'
,
'
testing
'
:
'
fractalis.config.TestingConfig
'
,
...
...
@@ -23,6 +32,19 @@ config = {
def
configure_app
(
app
):
"""
Apply configuration to given flask app based on environment variable.
This function assumes that the environment variable FRACTALIS_MODE contains
the key
'
development
'
,
'
testing
'
,
'
production
'
, or is unset in which case
it defaults to
'
production
'
. Each of these keys maps to a class in this
module that contains appropriate settings.
Arguments:
app (Flask) -- An instance of the app to configure
Exceptions:
KeyError (Exception) -- Is raised when FRACTALIS_MODE contains unknown key
"""
mode
=
os
.
getenv
(
'
FRACTALIS_MODE
'
,
default
=
'
production
'
)
try
:
app
.
config
.
from_object
(
config
[
mode
])
...
...
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