Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
40809d9c
Commit
40809d9c
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Change setting names.
parent
a05e37dd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/email.py
+1
-5
1 addition, 5 deletions
app/email.py
app/main/views.py
+5
-5
5 additions, 5 deletions
app/main/views.py
config.py
+21
-20
21 additions, 20 deletions
config.py
with
27 additions
and
30 deletions
app/email.py
+
1
−
5
View file @
40809d9c
...
...
@@ -10,11 +10,7 @@ def send_async_email(app, msg):
def
send_email
(
to
,
subject
,
template
,
**
kwargs
):
subject
=
'
{} {}
'
.
format
(
current_app
.
config
[
'
OPAQUE_MAIL_SUBJECT_PREFIX
'
],
subject
)
msg
=
Message
(
subject
,
sender
=
current_app
.
config
[
'
OPAQUE_MAIL_SENDER
'
],
recipients
=
[
to
])
msg
=
Message
(
'
[Opaque] {}
'
.
format
(
subject
),
recipients
=
[
to
])
msg
.
body
=
render_template
(
template
+
'
.txt.j2
'
,
**
kwargs
)
msg
.
html
=
render_template
(
template
+
'
.html.j2
'
,
**
kwargs
)
thr
=
Thread
(
target
=
send_async_email
,
...
...
This diff is collapsed.
Click to expand it.
app/main/views.py
+
5
−
5
View file @
40809d9c
...
...
@@ -21,7 +21,7 @@ def corpus(corpus_id):
print
(
'
Corpus not found.
'
)
abort
(
404
)
dir
=
os
.
path
.
join
(
current_app
.
config
[
'
OPAQUE_STORAGE
'
],
dir
=
os
.
path
.
join
(
current_app
.
config
[
'
OPAQUE_STORAGE
_DIRECTORY
'
],
str
(
current_user
.
id
),
'
corpora
'
,
str
(
corpus
.
id
))
...
...
@@ -44,7 +44,7 @@ def corpus_download(corpus_id):
if
not
file
or
not
corpus
:
print
(
'
File not found.
'
)
abort
(
404
)
dir
=
os
.
path
.
join
(
current_app
.
config
[
'
OPAQUE_STORAGE
'
],
dir
=
os
.
path
.
join
(
current_app
.
config
[
'
OPAQUE_STORAGE
_DIRECTORY
'
],
str
(
current_user
.
id
),
'
corpora
'
,
str
(
corpus
.
id
))
...
...
@@ -66,7 +66,7 @@ def dashboard():
db
.
session
.
add
(
corpus
)
db
.
session
.
commit
()
dir
=
os
.
path
.
join
(
app
.
config
[
'
OPAQUE_STORAGE
'
],
dir
=
os
.
path
.
join
(
app
.
config
[
'
OPAQUE_STORAGE
_DIRECTORY
'
],
str
(
corpus
.
user_id
),
'
corpora
'
,
str
(
corpus
.
id
))
...
...
@@ -96,7 +96,7 @@ def job(job_id):
print
(
'
Job not found.
'
)
abort
(
404
)
dir
=
os
.
path
.
join
(
current_app
.
config
[
'
OPAQUE_STORAGE
'
],
dir
=
os
.
path
.
join
(
current_app
.
config
[
'
OPAQUE_STORAGE
_DIRECTORY
'
],
str
(
current_user
.
id
),
'
jobs
'
,
str
(
job
.
id
))
...
...
@@ -130,7 +130,7 @@ def job_download(job_id):
if
not
file
or
not
job
:
print
(
'
File not found.
'
)
abort
(
404
)
dir
=
os
.
path
.
join
(
current_app
.
config
[
'
OPAQUE_STORAGE
'
],
dir
=
os
.
path
.
join
(
current_app
.
config
[
'
OPAQUE_STORAGE
_DIRECTORY
'
],
str
(
current_user
.
id
),
'
jobs
'
,
str
(
job
.
id
))
...
...
This diff is collapsed.
Click to expand it.
config.py
+
21
−
20
View file @
40809d9c
import
os
basedir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
class
Config
:
'''
### Flask ###
'''
SECRET_KEY
=
os
.
environ
.
get
(
'
SECRET_KEY
'
)
or
'
hard to guess string
'
'''
### Flask-Mail ###
'''
MAIL_SERVER
=
os
.
environ
.
get
(
'
MAIL_SERVER
'
)
MAIL_PORT
=
int
(
os
.
environ
.
get
(
'
MAIL_PORT
'
))
MAIL_USE_TLS
=
os
.
environ
.
get
(
'
MAIL_USE_TLS
'
).
lower
()
==
'
true
'
MAIL_USERNAME
=
os
.
environ
.
get
(
'
MAIL_USERNAME
'
)
MAIL_PASSWORD
=
os
.
environ
.
get
(
'
MAIL_PASSWORD
'
)
OPAQUE_ADMIN
=
os
.
environ
.
get
(
'
OPAQUE_ADMIN
'
)
OPAQUE_STORAGE
=
os
.
environ
.
get
(
'
OPAQUE_STORAGE
'
)
OPAQUE_MAIL_SUBJECT_PREFIX
=
'
[Opaque]
'
OPAQUE_MAIL_SENDER
=
'
Opaque
'
SECRET_KEY
=
os
.
environ
.
get
(
'
SECRET_KEY
'
)
or
'
hard to guess string
'
MAIL_DEFAULT_SENDER
=
os
.
environ
.
get
(
'
MAIL_DEFAULT_SENDER
'
)
'''
### Flask-SQLAlchemy ###
'''
SQLALCHEMY_TRACK_MODIFICATIONS
=
False
'''
### Opaque ###
'''
OPAQUE_ADMIN
=
os
.
environ
.
get
(
'
OPAQUE_ADMIN
'
)
OPAQUE_STORAGE_DIRECTORY
=
os
.
environ
.
get
(
'
OPAQUE_STORAGE_DIRECTORY
'
)
@staticmethod
def
init_app
(
app
):
pass
class
DevelopmentConfig
(
Config
):
'''
### Flask ###
'''
DEBUG
=
True
SQLALCHEMY_DATABASE_URI
=
'
sqlite:///
'
+
os
.
path
.
join
(
basedir
,
'
data_dev.sqlite
'
)
'''
### Flask-SQLAlchemy ###
'''
SQLALCHEMY_DATABASE_URI
=
'
sqlite:///{}
'
.
format
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'
data_dev.sqlite
'
)
)
class
TestingConfig
(
Config
):
TESTING
=
True
SQLALCHEMY_DATABASE_URI
=
os
.
environ
.
get
(
'
TEST_DATABASE_URL
'
)
or
\
'
sqlite://
'
WTF_CSRF_ENABLED
=
False
# class ProductionConfig(Config):
class
ProductionConfig
(
Config
):
'''
### Flask-SQLAlchemy ###
'''
SQLALCHEMY_DATABASE_URI
=
os
.
environ
.
get
(
'
SQLALCHEMY_DATABASE_URI
'
)
config
=
{
'
development
'
:
DevelopmentConfig
,
'
testing
'
:
TestingConfig
,
# 'production': ProductionConfig,
'
production
'
:
ProductionConfig
,
'
default
'
:
DevelopmentConfig
}
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