Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
1d40f9d8
Commit
1d40f9d8
authored
May 14, 2020
by
Vladislav Rykov
Browse files
integrating mailing
parent
efd170e7
Changes
8
Hide whitespace changes
Inline
Side-by-side
app/__pycache__/config.cpython-37.pyc
View file @
1d40f9d8
No preview for this file type
app/app/__pycache__/__init__.cpython-37.pyc
View file @
1d40f9d8
No preview for this file type
app/app/__pycache__/views.cpython-37.pyc
View file @
1d40f9d8
No preview for this file type
app/app/dao/trigger/.trigger.py.swp
deleted
100644 → 0
View file @
efd170e7
File deleted
app/app/dao/trigger/__pycache__/trigger.cpython-37.pyc
View file @
1d40f9d8
No preview for this file type
app/app/views.py
View file @
1d40f9d8
from
app
import
app
from
app
import
app
from
flask_mail
import
Mail
,
Message
from
flask
import
render_template
,
request
,
redirect
,
url_for
,
session
,
send_from_directory
,
flash
from
flask
import
render_template
,
request
,
redirect
,
url_for
,
session
,
send_from_directory
,
flash
from
flask_mail
import
Message
import
psycopg2
import
psycopg2
import
app.dao.user.user
as
ud
import
app.dao.user.user
as
ud
...
@@ -23,6 +25,7 @@ MAX_PG_ENTRIES_USERS = 10
...
@@ -23,6 +25,7 @@ MAX_PG_ENTRIES_USERS = 10
MAX_PG_ENTRIES_DATA
=
10
MAX_PG_ENTRIES_DATA
=
10
MAX_PG_ENTRIES_GRAPH_HOURS
=
24
MAX_PG_ENTRIES_GRAPH_HOURS
=
24
mail
=
Mail
(
app
)
@
app
.
route
(
'/'
)
@
app
.
route
(
'/'
)
def
index
():
def
index
():
...
@@ -583,5 +586,22 @@ def alarm_rm():
...
@@ -583,5 +586,22 @@ def alarm_rm():
else
:
else
:
return
redirect
(
url_for
(
'index'
))
return
redirect
(
url_for
(
'index'
))
@
app
.
route
(
'/mail'
)
def
send_mail
():
print
(
1
)
msg
=
Message
(
'test message'
,
sender
=
'hpcaiotserver@gmail.com'
,
recipients
=
[
'al373630@uji.es'
])
print
(
2
)
msg
.
body
=
'Hello vlad, alert is here!'
print
(
3
)
res
=
mail
.
send
(
msg
)
print
(
res
)
return
res
def
pend_delete_all_ack
():
def
pend_delete_all_ack
():
pend
.
delete_all_ack
()
pend
.
delete_all_ack
()
app/config.py
View file @
1d40f9d8
...
@@ -24,6 +24,13 @@ class Config(object):
...
@@ -24,6 +24,13 @@ class Config(object):
# manual user signup by default
# manual user signup by default
USERS_SIGNUP
=
False
USERS_SIGNUP
=
False
# mail server config
MAIL_SERVER
=
'smtp.gmail.com'
MAIL_PORT
=
465
MAIL_USE_SSL
=
True
MAIL_USERNAME
=
'hpcaiotserver@gmail.com'
MAIL_PASSWORD
=
'HPC&A10T.'
class
ProductionConfig
(
Config
):
class
ProductionConfig
(
Config
):
pass
pass
...
...
app/requirements.txt
View file @
1d40f9d8
APScheduler==3.6.3
APScheduler==3.6.3
bcrypt==3.1.7
bcrypt==3.1.7
blinker==1.4
cffi==1.14.0
cffi==1.14.0
click==7.1.1
click==7.1.1
Flask==1.1.2
Flask==1.1.2
Flask-Mail==0.9.1
itsdangerous==1.1.0
itsdangerous==1.1.0
Jinja2==2.11.2
Jinja2==2.11.2
MarkupSafe==1.1.1
MarkupSafe==1.1.1
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment