Esempio n. 1
0
# Enable CSRF protection globally for Flask app
csrf = CSRFProtect(app)
csrf.init_app(app)
app.config.from_pyfile('portal.conf')
app.url_map.strict_slashes = False
app.config['DEBUG'] = True
app.permanent_session_lifetime = timedelta(minutes=1440)
app.config.update(SESSION_COOKIE_SECURE=True,
                  SESSION_COOKIE_HTTPONLY=True,
                  SESSION_COOKIE_SAMESITE='Lax')
# set up Markdown Rendering
md = Misaka()
md.__init__(app,
            tables=True,
            autolink=True,
            fenced_code=True,
            smartypants=True,
            quote=True,
            math=True,
            math_explicit=True)

# set up logging
handler = logging.handlers.RotatingFileHandler(
    filename=app.config['SLATE_WEBSITE_LOGFILE'])
handler.setLevel(logging.DEBUG)
app.logger.addHandler(handler)
formatter = logging.Formatter('%(asctime)s - %(levelname)s: %(message)s')
handler.setFormatter(formatter)

try:
    # Change to location of slate_portal_user file
    f = open("/slate_portal_user", "r")