亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

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

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

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

阆中市| 宁安市| 鄯善县| 渝北区| 南澳县| 周至县| 富锦市| 东阿县| 长汀县| 乳山市| 故城县| 南开区| 兴义市| 淅川县| 历史| 马龙县| 泗洪县| 汉沽区| 安康市| 广德县| 孟村| 莆田市| 北流市| 伊金霍洛旗| 化州市| 仁怀市| 疏附县| 徐州市| 长沙市| 大竹县| 九寨沟县| 上思县| 遵义市| 雅江县| 开平市| 揭西县| 龙山县| 蚌埠市| 扶余县| 望江县| 新源县|