Can you choose what files Frozen-Flask freezes?

我的未来我决定 提交于 2019-12-25 14:14:11

问题


I have an app that contains 3 apps within. One of the apps would be better if output as a static site because it is made up of static material as it is. I was able to use Frozen-Flask to create a static site application for the app on it's own, but I want to try and keep all three apps in the one WSGI app.

So my question is, is there a way to choose what files Frozen-Flask chooses to freeze so it ignores the files in app1/ and app3/ (see file structure below)?

Structure of files

Flask/

 -application.py

 -requirements.txt

 -settings.py

 -static/

  -css/

  -js/

  -etc/

 -templates/

  -app1/ **with index.html, etc within.

  -app2/ (app I want to make static)

  -app3/


回答1:


The keyword arguments with_no_argument_rules and log_url_for can be set to False when you create your Freezer instance and then you can call register_generator to register a function or functions that will output the URLs you want to freeze:

frozen = Freezer(with_no_argument_rules=False, log_url_for=False)

@frozen.register_generator
def your_generator_here():
    yield "your", {"paths": "here"}


来源:https://stackoverflow.com/questions/26937727/can-you-choose-what-files-frozen-flask-freezes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!