Example #1
0
#####################################
## Mail
#####################################
if RUNTIME_ENV in ("bae",):
    from bae.api.bcms import BaeBcms

    BAE_BCMS = BaeBcms(const.ACCESS_KEY, const.SECRET_KEY)

elif RUNTIME_ENV in ("local",):
    app.config["MAIL_SERVER"] = "localhost"
    app.config["MAIL_PORT"] = 25
    app.config["MAIL_USE_TLS "] = False
    app.config["MAIL_USE_SSL "] = False
    app.config["MAIL_USERNAME "] = "test"
    app.config["MAIL_PASSWORD "] = "test"

    from flask_mail import Mail

    mail = Mail(app)

elif RUNTIME_ENV in ("gae", "gae_dev"):
    pass

#####################################
## Image Upload
#####################################
if RUNTIME_ENV in ("bae",):
    from bae.api import bcs

    BAE_BCS = bcs.BaeBCS(const.BCS_ADDR, const.ACCESS_KEY, const.SECRET_KEY)
Example #2
0
mail.init_app(app)


# flask forms parameters
app.config["WTF_CSRF_SECRET_KEY"] = "wtf_secret"
app.config["SECRET_KEY"] = "wtf_secret"


# flask mail parameters
app.config["MAIL_SERVER"] = "smtp.mail.ru"
app.config["MAIL_PORT"] = "2525"
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USE_SSL"] = False
app.config["MAIL_DEBUG"] = True
app.config["MAIL_USERNAME "] = os.environ.get("MAIL_USERNAME")
app.config["MAIL_PASSWORD "] = os.environ.get("MAIL_PASSWORD")
app.config["MAIL_DEFAULT_SENDER "] = ADMIN_EMAIL


@app.route("/", methods=["GET"])
def main():
    return render_template("main.html")


@app.route("/contact/", methods=["GET", "POST"])
def contact():
    messages = defaultdict(list)
    form = AskQuestionForm()

    if request.method == "POST":
        form_data = request.form