Example #1
0
from flask import redirect,session

from datetime import datetime

from smokerlib import *
from sqlalchemy import desc
import smokerconfig 

import sys

app = Flask(__name__)
app.secret_key = smokerconfig.sessionsecret
app.config["GOOGLE_LOGIN_CLIENT_ID"] = smokerconfig.google_client_id
app.config["GOOGLE_LOGIN_CLIENT_SECRET"] = smokerconfig.google_client_secret
#app.config["GOOGLE_LOGIN_SCOPES"] = ""
app.config["GOOGLE_LOGIN_REDIRECT_URI"] = smokerconfig.apibaseurl + "/oauth2callback"
app.config["GOOGLE_LOGIN_REDIRECT_SCHEME"] = "https"
app.debug = False
googlelogin = GoogleLogin()
googlelogin.init_app(app)

if not app.debug:
	import logging
	from logging.handlers import RotatingFileHandler
	file_handler = RotatingFileHandler("/websites/applogs/smokerapi.log",maxBytes=10*2**20,backupCount=7)
	file_handler.setLevel(logging.DEBUG)
	app.logger.setLevel(logging.DEBUG)
	app.logger.addHandler(file_handler)

@app.teardown_appcontext
def close_db(error):