Example #1
0
    redirect,
    url_for,
    abort,
    render_template,
    flash,
    jsonify,
    send_from_directory,
)
from flask_cas import CAS
from flask_mail import Mail
from flask_mail import Message
import config

app = Flask(__name__)
# app.config.from_object('config')
app.config["CAS_SERVER"] = "https://netid.rice.edu"
app.config["CAS_AFTER_LOGIN"] = "afterlogin"
app.config["APP_URL"] = "localhost:5000"
app.config.setdefault("CAS_USERNAME_SESSION_KEY", "CAS_USERNAME")
CAS(app)

# Email setup
app.config["MAIL_SERVER"] = "smtp.zoho.com"
app.config["MAIL_PORT"] = 465
app.config["MAIL_USERNAME"] = config.MAIL_USERNAME
app.config["MAIL_PASSWORD"] = config.MAIL_PASSWORD
app.config["MAIL_USE_TLS"] = False
app.config["MAIL_USE_SSL"] = True
app.config["MAIL_SUPPRESS_SEND"] = False
app.config["TESTING"] = False
mail = Mail(app)
Example #2
0
import sqlite3
import flask
from datetime import datetime, timedelta
from flask import Flask, g, render_template, flash, redirect, session, url_for, request, abort
from flask.ext.cas import CAS
from flask.ext.cas import login_required
from contextlib import closing

cas = CAS()
application = Flask(__name__)
cas.init_app(application)
application.config["CAS_SERVER"] = "https://sso.acu.edu"
application.config["CAS_AFTER_LOGIN"] = "route_home"
application.config["CAS_VALIDATE_ROUTE"] = "/serviceValidate"
application.debug = True
DATABASE = "/tmp/test.db"
DEBUG = True
SECRET_KEY = "development key"
USERNAME = "admin"
PASSWORD = "default"


@application.route("/")
@login_required
def route_home():
    return redirect(url_for("vote_page"))


def connect_db():
    return sqlite3.connect("/tmp/test.db")