""" server.py - sets up and runs the flask server """ from flask import Flask from siteconfig import siteconfig from flask_compress import Compress from rss_generator import get_rss_channel app = Flask(__name__) compress = Compress() from views import * def setup(): """ setup - sets up the app according to the settings specified (or not specified) in `siteconfig` """ app.config['SECRET_KEY'] = siteconfig.SECRET_KEY app.config.update({'MAIN_SITE_DIRS': siteconfig.MAIN_SITE_DIRS}) app.config.update({'DOMAIN': siteconfig.DOMAIN}) app.config.update({'HOME_TITLE': siteconfig.HOME_TITLE}) app.config.update( {'COMPRESS_MIMETYPES': siteconfig.COMPRESS_MIMETYPES} ) app.config.update({'RSS_CHANNEL': get_rss_channel()}) app.config.update({'TEMPLATES_AUTO_RELOAD': True}) # Setup needs to come first to be compatible with wsgi setup() compress.init_app(app) if __name__ == "__main__": app.run()