import importlib.machinery
import importlib.util
import os
import sys


APPLICATION_ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, APPLICATION_ROOT)

def load_source(modname, filename):
    loader = importlib.machinery.SourceFileLoader(modname, filename)
    spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
    module = importlib.util.module_from_spec(spec)
    loader.exec_module(module)
    return module

wsgi = load_source('contentflow_wsgi', os.path.join(APPLICATION_ROOT, 'app.py'))
application = wsgi.application
