2016-04-29 126 views
0

我的燒瓶web應用上的頁面正常顯示,但服務器不斷返回錯誤:錯誤13,權限被拒絕。 有人可以幫我弄清楚這裏發生了什麼? 代碼爲我的意見文件:對於HTML燒瓶權限訪問被拒絕在服務器上顯示

@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" 

代碼調用個人網頁:

<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 
+0

Errno 13指向文件系統權限問題,請確保您已將它們設置正確,並且燒瓶進程可以訪問所有項目文件。 –

+0

通常你在_Flask_之上有一個Web服務器。檢查Web服務器是否在必要的用戶權限下運行。 – davidshen84

+0

謝謝您快速回復我。據我所知,文件或服務器上沒有權限設置。但我只是注意到在cmd行服務器顯示的頂部有一些東西。 編輯初始文章以包含顯示。 – Anselm

回答

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"