V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
qiu0130
V2EX  ›  Python

Flask Mako 模版问题

  •  
  •   qiu0130 · 2016-05-28 18:40:14 +08:00 · 2580 次点击
    这是一个创建于 2861 天前的主题,其中的信息可能已经有所发展或是发生改变。

    说有一个

    app.py

    def fun():

      xxxx

      return xxx

    home.html

    为什么不能使用${ fun() }

    3 条回复    2016-05-30 00:24:33 +08:00
    jzp113
        1
    jzp113  
       2016-05-28 19:20:48 +08:00
    那还要 js 干嘛
    qiu0130
        2
    qiu0130  
    OP
       2016-05-28 19:45:25 +08:00
    @jzp113 js 处理后台数据?
    fohnwind
        3
    fohnwind  
       2016-05-30 00:24:33 +08:00   ❤️ 1
    mako 貌似是直接渲染内容吧,根据变量。如果要使用函数的话试试 jinja2 ?
    理解有限。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1639 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 16:49 · PVG 00:49 · LAX 09:49 · JFK 12:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.