move Mail object to mailsender
This commit is contained in:
parent
9b4d98e3d9
commit
413500c53f
3 changed files with 4 additions and 4 deletions
|
@ -16,11 +16,11 @@ from flask import (
|
||||||
from waitress import serve
|
from waitress import serve
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
from flask_bootstrap import Bootstrap
|
from flask_bootstrap import Bootstrap
|
||||||
from flask_mail import Mail
|
|
||||||
from flask_wtf.csrf import CSRFProtect, CSRFError
|
from flask_wtf.csrf import CSRFProtect, CSRFError
|
||||||
from flask_moment import Moment
|
from flask_moment import Moment
|
||||||
|
|
||||||
from models import db, lm
|
from models import db, lm
|
||||||
|
from mailsender import mail
|
||||||
|
|
||||||
sys.stderr.write("worker uid={} gid={}".format(os.getuid(), os.getgid()))
|
sys.stderr.write("worker uid={} gid={}".format(os.getuid(), os.getgid()))
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
@ -31,7 +31,6 @@ app.config.from_object("config.Config")
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
lm.init_app(app)
|
lm.init_app(app)
|
||||||
|
|
||||||
mail = Mail()
|
|
||||||
mail.init_app(app)
|
mail.init_app(app)
|
||||||
|
|
||||||
bootstrap = Bootstrap()
|
bootstrap = Bootstrap()
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from flask import current_app, render_template
|
from flask import current_app, render_template
|
||||||
from flask_mail import Message
|
from flask_mail import Mail, Message
|
||||||
from decorators import asyncfn
|
from decorators import asyncfn
|
||||||
|
|
||||||
|
mail = Mail()
|
||||||
|
|
||||||
@asyncfn
|
@asyncfn
|
||||||
def send_async_email(app, msg):
|
def send_async_email(app, msg):
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
<li><a href="{{ url_for('panel.dashboard') }}"><span class="glyphicon glyphicon-modal-window"></span> Dashboard</a></li>
|
<li><a href="{{ url_for('panel.dashboard') }}"><span class="glyphicon glyphicon-modal-window"></span> Dashboard</a></li>
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
<li><a href="{{ url_for('settings.profile') }}"><span class="glyphicon glyphicon-user"></span> Profile</a></li>
|
<li><a href="{{ url_for('settings.profile') }}"><span class="glyphicon glyphicon-user"></span> Profile</a></li>
|
||||||
<!-- <li><a href="{{ url_for('panel.support_list') }}"><span class="glyphicon glyphicon-question-sign"></span> Support</a></li>-->
|
|
||||||
<li><a href="{{ url_for('auth.logout') }}"><span class="glyphicon glyphicon-off"></span> Logout</a></li>
|
<li><a href="{{ url_for('auth.logout') }}"><span class="glyphicon glyphicon-off"></span> Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue