Flask权限访问被拒绝在服务器上显示

时间:2016-04-29 09:38:08

标签: python flask jinja2

我的烧瓶网络应用程序上的页面正常显示,但服务器仍然返回错误:错误号13,权限被拒绝。 有人可以帮我弄清楚这里发生了什么? 我的观点文件的代码:

@app.route('/')
@app.route('/index', methods=['GET', 'POST'])
def index():
    login_link = True
    if request.method == 'POST':
        return redirect(url_for('personal'))
    return render_template('index.html', login_link = login_link)


@app.route('/<path:path>')
def catch_all(path):
    my_path = path.split('/')
    login_link = False
    page_title = my_path[len(my_path) - 1]
    page_link = ""
    page_heading = ""
    if page_title == 'today':
        page_title = "Today"
        page_heading = "Events Scheduled for Today"
        page_link = "today.html"
    elif page_title == 'next':
        page_title = "This Week"
        page_heading = "Events for Next Seven(7) Days"
        page_link = "today.html"
    elif page_title == 'personal':
        page_title = "Personal"
        page_heading = "Add Personal Tasks"
        page_link = "addtask.html"

调用个人页面的html代码:

<form class="ui form" action="personal" method="" style="margin-right: 20px; margin-top: 20px;">
        <div class="field">
          <label>Username</label>
          <div class="ui left icon input">
            <input name="username" placeholder="Username" type="text">
            <i class="user icon"></i>
          </div>

我注意到服务器在尝试获取favicon.ico文件时抛出错误。我当然没有在我的作品中添加一个图标。下面是命令行服务器显示。

 * Debugger is active!
 * Debugger pin code: 585-133-842
 * Detected change in 'E:\\My_Andela_Project\\Semantic\\DoWell_Web_App\\dowell\\views.py', reloading
 * Restarting with stat
 * Debugger is active!
 * Debugger pin code: 585-133-842
127.0.0.1 - - [29/Apr/2016 11:11:09] "GET /index HTTP/1.1" 200 -
127.0.0.1 - - [29/Apr/2016 11:11:10] "GET /favicon.ico HTTP/1.1" 500 -
Traceback (most recent call last):
  File "E:\My_Andela_Project\DoWell_Web_App\flask\lib\site-packages\flask\app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "E:\My_Andela_Project\DoWell_Web_App\flask\lib\site-packages\flask\app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "E:\My_Andela_Project\DoWell_Web_App\flask\lib\site-packages\flask\app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "E:\My_Andela_Project\DoWell_Web_App\flask\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value

1 个答案:

答案 0 :(得分:0)

谢谢你们。你一直非常乐于助人。所以我通过实际为我的工作提供一个favicon解决了这个问题。我偶然发现了烧瓶目录中的日志文件。所以我决定添加一个图标,解决了这个问题。

\flask\Lib\site-packages\werkzeug\debug\tbtools.py:
  <link rel="stylesheet" href="?__debugger__=yes&amp;cmd=resource&amp;f=style.css" type="text/css">
   <!-- We need to make sure this has a favicon so that the debugger does
    not by accident trigger a request to /favicon.ico which might
   change the application state. -->
   <link rel="shortcut icon"