91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Flask error: werkzeug.routing.BuildError

發布時間:2020-07-19 19:20:55 來源:網絡 閱讀:1671 作者:DevOperater 欄目:開發技術


@main.route('/sendfile', methods=['GET', 'POST'])
def sendfile():
    if request.method == 'POST':
        f = request.files['file']
        basepath = path.abspath(path.dirname(__file__))
        upload_path = path.join(basepath, 'static/uploads')
        f.save(upload_path + '/' + secure_filename(f.filename))
        return redirect(url_for('sendfile'))
    return render_template('sendfile.html')





^CwulilideMacBook-Pro:Manage root# python Manage.py runserver

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

 * Restarting with stat

127.0.0.1 - - [21/Nov/2016 18:24:31] "GET /sendfile HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:32] "GET / HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:32] "GET / HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:34] "GET /sendfile HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:40] "POST /sendfile HTTP/1.1" 500 -

Traceback (most recent call last):

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__

    return self.wsgi_app(environ, start_response)

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app

    response = self.make_response(self.handle_exception(e))

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception

    reraise(exc_type, exc_value, tb)

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app

    response = self.full_dispatch_request()

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request

    rv = self.handle_user_exception(e)

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception

    reraise(exc_type, exc_value, tb)

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request

    rv = self.dispatch_request()

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request

    return self.view_functions[rule.endpoint](**req.view_args)

  File "/Users/wulili/myproject/Manage/app/main/views.py", line 25, in sendfile

    return redirect(url_for('sendfile'))

  File "/Library/Python/2.7/site-packages/flask/helpers.py", line 312, in url_for

    return appctx.app.handle_url_build_error(error, endpoint, values)

  File "/Library/Python/2.7/site-packages/flask/app.py", line 1641, in handle_url_build_error

    reraise(exc_type, exc_value, tb)

  File "/Library/Python/2.7/site-packages/flask/helpers.py", line 305, in url_for

    force_external=external)

  File "/Library/Python/2.7/site-packages/werkzeug/routing.py", line 1678, in build

    raise BuildError(endpoint, values, method)

BuildError: ('sendfile', {}, None)

127.0.0.1 - - [21/Nov/2016 18:24:40] "GET /sendfile?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:40] "GET /sendfile?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:40] "GET /sendfile?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:40] "GET /sendfile?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:40] "GET /sendfile?__debugger__=yes&cmd=resource&f=source.png HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:40] "GET /sendfile?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -

127.0.0.1 - - [21/Nov/2016 18:24:40] "GET /sendfile?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -

 * Detected change in '/Users/wulili/myproject/Manage/app/main/views.py', reloading

 * Restarting with stat



解決方法:


if you are using blueprints, url_for should be invoked as url_for(blueprint_name.func_name).

main 為藍圖的名字

修改后的代碼為



@main.route('/sendfile', methods=['GET', 'POST'])
def sendfile():
   if request.method == 'POST':
       f = request.files['file']
       basepath = path.abspath(path.dirname(__file__))
       upload_path = path.join(basepath, 'static/uploads')
       f.save(upload_path + '/' + secure_filename(f.filename))
       return redirect(url_for('main.sendfile'))
   return render_template('sendfile.html')


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

武邑县| 城市| 汤阴县| 林州市| 杭州市| 罗甸县| 金华市| 那坡县| 定襄县| 周口市| 大渡口区| 临潭县| 乌兰浩特市| 阜新市| 阳新县| 越西县| 六枝特区| 新田县| 玉林市| 老河口市| 宁津县| 台州市| 塔城市| 雷波县| 海城市| 清水县| 舒城县| 托里县| 东乌珠穆沁旗| 嘉峪关市| 鱼台县| 黔江区| 扶风县| 逊克县| 鄄城县| 永德县| 兰州市| 桐乡市| 万年县| 合江县| 新竹县|