def create_app(self):
        app = Flask(
            __name__,
            template_folder=os.path.dirname(os.path.abspath(__file__)) +
            "/fixtures",
        )

        app.config["TESTING"] = True

        template_finder_view = TemplateFinder.as_view("template_finder")
        app.add_url_rule("/", view_func=template_finder_view)
        app.add_url_rule("/<path:subpath>", view_func=template_finder_view)

        return app
예제 #2
0
파일: app.py 프로젝트: jpmartinspt/maas.io
)
from canonicalwebteam.flask_base.app import FlaskBase
from canonicalwebteam.templatefinder import TemplateFinder
from canonicalwebteam.search import build_search_view
from canonicalwebteam import image_template

from webapp.feeds import get_rss_feed

app = FlaskBase(
    __name__,
    "maas.io",
    template_folder="../templates",
    static_folder="../static",
)

template_finder_view = TemplateFinder.as_view("template_finder")
app.add_url_rule("/", view_func=template_finder_view)
app.add_url_rule("/<path:subpath>", view_func=template_finder_view)

doc_parser = DocParser(
    api=DiscourseAPI(base_url="https://discourse.maas.io/"),
    index_topic_id=25,
    url_prefix="/docs",
)
if app.debug:
    doc_parser.api.session.adapters["https://"].timeout = 99
discourse_docs = DiscourseDocs(
    parser=doc_parser,
    document_template="docs/document.html",
    category_id=5,
    url_prefix="/docs",