你能选择什么文件冻结瓶冻结? [英] Can you choose what files Frozen-Flask freezes?

查看:171
本文介绍了你能选择什么文件冻结瓶冻结?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含3个应用程序的应用程序。如果输出为静态网站,其中一个应用会更好,因为它由静态材料组成。我可以使用Frozen-Flask为应用程序创建一个静态站点应用程序,但是我想尝试将这三个应用程序保存在一个WSGI应用程序中。

<所以我的问题是,有没有办法选择什么文件冻结瓶选择冻结,所以它忽略了app1 /和app3 /中的文件?(见下面的文件结构)?

文件结构

烧瓶/



  -application.py



  -requirements.txt

  -settings.py

  -static /



   -css /



   -js / b
$ b

   -etc /



  -templates /



  -app1 / **与index.html等内。



   -app2 /(app I想要使静态)



  -app3 /

解决方案

关键字参数 with_no_argument_rules and > log_url_for 设置为 False ://pythonhosted.org/Frozen-Flask/#flask_frozen.Freezerrel =nofollow> Freezer 实例,然后您可以调用 register_generator 注册一个或多个函数输出您想要冻结的网址:

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

@ frozen.register_generator
def your_generator_here():
产生your,{paths:here}


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/

解决方案

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"}

这篇关于你能选择什么文件冻结瓶冻结?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆