Beispiel #1
0
from flask import render_template
from flask.ext.mail import Message
from calpoly.core import mail
from calpoly.config import SENDER
from calpoly.decorators import async
from calpoly.api import create_app


app = create_app()


@async
def send_message(subject, sender, recipients, text_body, html_body):
    msg = Message(subject, sender=sender, recipients=recipients)
    msg.body = text_body
    msg.html = html_body
    with app.app_context():
        mail.send(msg)


def send_reset_password_email(username, user_email, url):
    send_message("[IEEE] Forgotten Password",
                 SENDER,
                 [user_email],
                 render_template("emails/reset_password.txt",
                                 user=username,
                                 url=url),
                 render_template("emails/reset_password.html",
                                 user=username,
                                 url=url))
Beispiel #2
0
# -*- coding: utf-8 -*-
"""
    wsgi
    ~~~~

    ieee wsgi module
"""

from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware

from calpoly import api, frontend

application = DispatcherMiddleware(frontend.create_app(), {
    '/api': api.create_app()
})

if __name__ == "__main__":
    run_simple('localhost', 5000, application, use_reloader=True,
               use_debugger=True, use_evalex=True)