标签: web2py

一个表单可以有两个提交按钮吗?

我正在使用 web2py 编写类似应用程序的搜索引擎。是否可以为一个表单实现两个提交按钮,例如谷歌有两个按钮“搜索”和“我很幸运”。提前致谢。

html python web2py

3
推荐指数
1
解决办法
2282
查看次数

Web2py:自定义表单的自定义CSS类

如何指定自定义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

css python web2py

3
推荐指数
1
解决办法
1959
查看次数

如何在Apache服务器上运行web2py项目?

我想用web2py开发我的项目.在此之前我用python cherrypy制作它.现在要切换到web2py.但我想使用Apache服务器而不是WSGI和web2py服务器!

你能指导我这是怎么做到的吗?

python apache web2py

3
推荐指数
1
解决办法
6750
查看次数

如何获取web2py中表格中的字段对象列表?

如何获取表格中所有字段对象(例如gluon.dal.Field)的列表?下列

db.customer.fields

只返回一个字符串列表,这些字符串是字段名称.

web2py

3
推荐指数
1
解决办法
1845
查看次数

如何使用 Dockerfile 运行 Google 应用引擎服务器

我是 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)

google-app-engine web2py docker

3
推荐指数
1
解决办法
2466
查看次数

在 web2py 控制器中使用参数重定向 URL

我正在尝试使用参数从 forminput.html 重定向到 URL('form','results') (在我的例子中,它是一个巨大的字典,即输出)。但是,当网页重定向到 results.html 时,所有参数也包含在 Web Url 本身中,这是我们不想要的,原因有两个:安全性和冗长的 url 类型。
在这种情况下你能帮我吗?
提前致谢

这是 URL 的示例。
http://127.0.0.1:8000/AWS/form/results?csp=&ibx=&metro=&o=%7B%22se1.sv1%22%3A+%7B%22xe-0%2F2%2F1%22%3A+%7B %22Util%22%3A+66%2C%22c_name%22%3A+%22dxcon-fh26tz6s%22%2C%22c_serial%22%3A+%2215563580-A%22%7D%2C%22xe-2%2F1%2F3%22 %3A+%7B%22Util%22%3A+31%2C%22c_name%22%3A+%22dxcon-fgptdigg%22%2C%22c_serial%22%3A+%2220130277-A%22%7D%2C%22xe-3%2F0 %2F3%22%3A+%7B%22Util%22%3A+0%2C%22c_name%22%3A+%22SFDC-SV3-CX-SEC-01%22%2C%22c_serial%22%3A+%2220375541-A%22 %7D%2C%22xe-3%2F1%2F2%22%3A+%7B%22Util%22%3A+0%2C%22c_name%22%3A+%22dxcon-ffj66n3f%22%2C%22c_serial%22%3A+%2220347645 -A%22%7D%2C%22xe-3%2F2%2F3%22%3A+%7B%22Util%22%3A+0%2C%22c_name%22%3A+%22dxcon-fgsmxuat%22%2C%22c_serial%22 %3A+%2220366330-A%22%7D%7D%7D#

/*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)

python redirect web2py python-2.7 web2py-modules

3
推荐指数
1
解决办法
2031
查看次数

多选列表,每个项目都有数量选项

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 …

html javascript web2py

3
推荐指数
1
解决办法
2080
查看次数

如何使web2py dev服务器跟踪文件更改并自动重启?

我曾经使用过Django以及runserver每当更改某个python文件时它会自动重启的方式.这非常方便,让我的开发更容易.

有没有办法告诉web2py开发服务器跟踪python文件中的更改并自动重启?

任何帮助表示赞赏.

python web2py

2
推荐指数
1
解决办法
941
查看次数

使用web2py从POST ajax调用获取数据

我正在对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)

正在寻找""而不是实际存在于数据库中的任何东西.

python ajax web2py

2
推荐指数
1
解决办法
7335
查看次数

Pythonanywhere Web2Py重定向到HTTPS

我已经创建了一个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)

python web2py pythonanywhere

2
推荐指数
1
解决办法
760
查看次数