我是 Python Web 框架的新手,我选择 web.py 作为起点。
我按照 web.py 网站上的教程,发现了 urls、POST 和 GET 的工作原理,但我对如何使用模板和模板引擎感到困惑。
我有一个自定义 html 表单,想在我的应用程序中使用它。我应该使用“模板引擎”还是应该使用 web.py 内置表单库?
谁能给我一个如何将自定义表单值发布到 web.py 应用程序的示例?(使用没有内置库的表单。)
提前致谢。
You can use web.py form library to render only parts of the form in your templates, see http://webpy.org/cookbook/form_fields
Andrey Kuzmin 的回答与“自定义表单”不兼容。他链接的教程是通过 web.py 生成的表单您可以获取自定义表单的表单变量
def POST(self):
user_data = web.input()
return user_data.YOUR_CUSTOM_HTML_FORM_VAR