小编Don*_*cha的帖子

瓶:未定义全局变量'请求'

我正在使用python创建一个基于Web的应用程序,用户输入搜索查询并返回数据.我用瓶子为此提供了web框架.然后使用Openshift在线发布.这是一个简单的帖子表格,然后在下一节中使用搜索条件:

@route('/')
def search():
    return '''
        <h1 align="center">Twitter Sentiment Analysis</h1>
        <p align="center">Enter what you would like to search in the search box below</p>
            <form action="/result" method="post" align="center">
                Search: <input name="search" type="text" />
                <input value="Search" type="submit" />
            </form>
        '''

@route('/result', method='POST')
def result():
    search = request.forms.get('search')
    return 'it worked'    
Run Code Online (Sandbox Code Playgroud)

当使用瓶子并测试它时,它工作正常,但是当我尝试将其部署到OpenShift时,我得到一个名称错误,"全局变量'请求'未定义"在测试时它在部署到openshift之前只与瓶子完美配合,有谁知道为什么会这样?

python bottle python-2.7 openshift

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

标签 统计

bottle ×1

openshift ×1

python ×1

python-2.7 ×1