我正在使用 web2py 编写类似应用程序的搜索引擎。是否可以为一个表单实现两个提交按钮,例如谷歌有两个按钮“搜索”和“我很幸运”。提前致谢。
如何指定自定义web2py表单的类?例如
{{=form.custom.begin}}
Image name: <div>{{=form.custom.widget.name}}</div>
Image file: <div>{{=form.custom.widget.file}}</div>
Click here to upload: {{=form.custom.submit}}
{{=form.custom.end}}
Run Code Online (Sandbox Code Playgroud)
我如何指定CSS类form?
我想用web2py开发我的项目.在此之前我用python cherrypy制作它.现在要切换到web2py.但我想使用Apache服务器而不是WSGI和web2py服务器!
你能指导我这是怎么做到的吗?
如何获取表格中所有字段对象(例如gluon.dal.Field)的列表?下列
db.customer.fields
只返回一个字符串列表,这些字符串是字段名称.
我是 docker 新手,我需要使用 Dockerfile 在谷歌应用引擎服务器中运行 web2py 应用程序,为此我创建了 dockerfile 来安装 python、gae 服务器和我的 web2py 源文件夹。
我的问题是如何使用 Dockerfile 启动 gae 服务器以及如何将现有源代码配置为 gae 以及如何运行 gae 服务器以基于运行容器 IP 的 docker 在浏览器上查看我的应用程序登陆页面
这是我的 Dockerfile
FROM ubuntu:trusty
MAINTAINER John
#install python
RUN sudo apt-get install python --assume-yes
RUN apt-get install -y wget unzip
#install GAE
RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud- sdk.zip && unzip google-cloud-sdk.zip && rm google-cloud-sdk.zip
RUN google-cloud-sdk/install.sh --usage-reporting=true --path-update=true -- bash-completion=true --rc-path=/.bashrc --additional-components app-engine-python
ENV PATH /google-cloud-sdk/bin:$PATH
COPY Testapp/ .
RUN pwd
WORKDIR Testapp
CMD python web2py.py …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用参数从 forminput.html 重定向到 URL('form','results') (在我的例子中,它是一个巨大的字典,即输出)。但是,当网页重定向到 results.html 时,所有参数也包含在 Web Url 本身中,这是我们不想要的,原因有两个:安全性和冗长的 url 类型。
在这种情况下你能帮我吗?
提前致谢
/*this my controller, form.py*/
my_funct():
out_dict=dict() // out_dict is a huge dictionary with 100 of keys and values
return out_dict
define forminput():
outout=my_funct()
redirect(URL('form','results', vars= dict(out=output)))
define results():
data=request.vars['out']
Run Code Online (Sandbox Code Playgroud) I have a free text field in my html page, but I want to fill it with given strings. So lets say I have strings, "apple", "banana" and "pineapple", and now I want to have a button "add content" that opens a modal box, or if it's easier simply a list embedded in my page, that gives me a list where I can select multiple items with the option to enter a quantity for each selected item and adds the …
我曾经使用过Django以及runserver每当更改某个python文件时它会自动重启的方式.这非常方便,让我的开发更容易.
有没有办法告诉web2py开发服务器跟踪python文件中的更改并自动重启?
任何帮助表示赞赏.
我正在对python函数进行AJAX调用.该函数根据发送给函数的信息执行数据库查询.
我无法弄清楚如何获取发送到函数的变量.
我正在使用request.vars.variableName,我知道该函数是有效的,它只是没有收到正确使用的变量.如何使用web2py从python函数获取POST发送变量?
ETA:这是我正在使用的代码
jQuery.ajax(
{type: "POST",
url: '../../Printed/printedballoons/cost.json', //python function
data: typeSelected,//data sent to server
dataType: 'json',
error: function(msg){$("#ajaxerror").html(msg);},
success: function(data){
balloonPrice = data.cost;
},
timeout: 2000}
);
Run Code Online (Sandbox Code Playgroud)
错误发生在"data:typeSelected"行中,变量名称与任何数据都没有关联,所以python查询:
cost=db(db.balloonprices.type==request.vars.typeSelected).select(db.balloonprices.cost)
Run Code Online (Sandbox Code Playgroud)
正在寻找""而不是实际存在于数据库中的任何东西.
我已经创建了一个webproject Web2Py,并希望用户在正常的http://instaed 上访问这些页面http://.
每次我输入http://domain.pythonanywhere.comet重定向我http://domain.pythonanywhere.com.
它的时间为0.5秒.进行SSL检查,我想避免这种情况.
这是默认值:
## if SSL/HTTPS is properly configured and you want all HTTP requests to
## be redirected to HTTPS, uncomment the line below:
# request.requires_https()
Run Code Online (Sandbox Code Playgroud) web2py ×10
python ×7
html ×2
ajax ×1
apache ×1
css ×1
docker ×1
javascript ×1
python-2.7 ×1
redirect ×1