运行Django App服务时出现无法解释的500内部服务器错误

时间:2016-11-10 17:47:53

标签: python django azure azure-web-sites

以下是我设置它的步骤。

  1. 我在Azure门户上创建了一个样板Django应用服务。它工作得很好,一个空白的django应用程序出现在我的应用程序服务的URL上。

  2. 然后我从他们的样板中复制了以下所有配置文件: https://github.com/azureappserviceoss/DjangoAzure

    • .skipPythonDeployment
    • azuredeploy.json
    • ptvs_virtualenv_proxy.py
    • web.config(将其修改为指向我的实际项目设置和wsgi)
    • web.debug.config
  3. 将这些配置文件推送到我自己的django项目之后,我在azure上设置了App服务,指向我的github存储库,而不是我上面链接的样板库。它成功地设置了持续部署和获取/构建存储库。

  4. 我的应用页面现在只显示文字:

  5.   

    由于发生内部服务器错误,无法显示页面。

    应用程序日志流返回以下内容:

    <div id="content"> 
    <div class="content-container"> 
    <h3>HTTP Error 500.0 - Internal Server Error</h3> 
    <h4>The page cannot be displayed because an internal server error has occurred.</h4> 
    </div> 
    <div class="content-container"> 
    <fieldset><h4>Most likely causes:</h4> 
    <ul>    <li>IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.</li>    <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.</li>    <li>IIS was not able to process configuration for the Web site or application.</li>     <li>The authenticated user does not have permission to use this DLL.</li>   <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li> </ul> 
    </fieldset> 
    </div> 
    <div class="content-container"> 
    <fieldset><h4>Things you can try:</h4> 
    <ul>    <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li>     <li>Check the event logs to see if any additional information was logged.</li>  <li>Verify the permissions for the DLL.</li>    <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li>  <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul> 
    </fieldset> 
    </div> 
    
    <div class="content-container"> 
    <fieldset><h4>Detailed Error Information:</h4> 
    <div id="details-left"> 
    <table border="0" cellpadding="0" cellspacing="0"> 
    <tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;FastCgiModule</td></tr> 
    <tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;ExecuteRequestHandler</td></tr> 
    <tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;Python FastCGI</td></tr> 
    <tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x00000000</td></tr> 
    
    </table> 
    </div> 
    <div id="details-right"> 
    <table border="0" cellpadding="0" cellspacing="0"> 
    <tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;http://projectone-api:80/handler.fcgi/</td></tr> 
    <tr><th>Physical Path</th><td>&nbsp;&nbsp;&nbsp;D:\home\site\wwwroot\handler.fcgi\</td></tr> 
    <tr class="alt"><th>Logon Method</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr> 
    <tr><th>Logon User</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr> 
    
    </table> 
    <div class="clear"></div> 
    </div> 
    </fieldset> 
    </div> 
    
    <div class="content-container"> 
    <fieldset><h4>More Information:</h4> 
    This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error. 
    <p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=500,0,0x00000000,9200">View more information &raquo;</a></p> 
    <p>Microsoft Knowledge Base Articles:</p> 
    
    
    </fieldset> 
    </div> 
    </div> 
    

    作为请求,这是我的WSGI日志:

    2016-11-10 17:58:22.405000: wfastcgi.py 2.1.1 started
    2016-11-10 17:58:22.405000: Python version: 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]
    2016-11-10 17:58:22.421000: wfastcgi.py 2.1.1 initializing
    2016-11-10 17:58:22.452000: Activating virtualenv with D:\home\site\wwwroot\env\Scripts\activate_this.py
    2016-11-10 17:58:22.468000: Error occurred while reading WSGI handler:
    
    Traceback (most recent call last):
      File "D:\Python27\Scripts\wfastcgi.py", line 711, in main
        env, handler = read_wsgi_handler(response.physical_path)
      File "D:\Python27\Scripts\wfastcgi.py", line 568, in read_wsgi_handler
        return env, get_wsgi_handler(handler_name)
      File "D:\Python27\Scripts\wfastcgi.py", line 541, in get_wsgi_handler
        handler = handler()
      File ".\ptvs_virtualenv_proxy.py", line 99, in get_virtualenv_handler
        execfile(activate_this, dict(__file__=activate_this))
    IOError: [Errno 2] No such file or directory: 'D:\\home\\site\\wwwroot\\env\\Scripts\\activate_this.py'
    
    
    StdOut: 
    
    StdErr: 
    2016-11-10 17:58:22.468000: Unhandled exception in wfastcgi.py: Traceback (most recent call last):
      File "D:\Python27\Scripts\wfastcgi.py", line 711, in main
        env, handler = read_wsgi_handler(response.physical_path)
      File "D:\Python27\Scripts\wfastcgi.py", line 568, in read_wsgi_handler
        return env, get_wsgi_handler(handler_name)
      File "D:\Python27\Scripts\wfastcgi.py", line 541, in get_wsgi_handler
        handler = handler()
      File ".\ptvs_virtualenv_proxy.py", line 99, in get_virtualenv_handler
        execfile(activate_this, dict(__file__=activate_this))
    IOError: [Errno 2] No such file or directory: 'D:\\home\\site\\wwwroot\\env\\Scripts\\activate_this.py'
    2016-11-10 17:58:22.483000: wfastcgi.py 2.1.1 closed
    2016-11-10 17:58:34.608000: wfastcgi.py 2.1.1 started
    2016-11-10 17:58:34.624000: Python version: 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]
    2016-11-10 17:58:34.624000: wfastcgi.py 2.1.1 initializing
    2016-11-10 17:58:34.655000: Activating virtualenv with D:\home\site\wwwroot\env\Scripts\activate_this.py
    2016-11-10 17:58:34.655000: Error occurred while reading WSGI handler:
    
    Traceback (most recent call last):
      File "D:\Python27\Scripts\wfastcgi.py", line 711, in main
        env, handler = read_wsgi_handler(response.physical_path)
      File "D:\Python27\Scripts\wfastcgi.py", line 568, in read_wsgi_handler
        return env, get_wsgi_handler(handler_name)
      File "D:\Python27\Scripts\wfastcgi.py", line 541, in get_wsgi_handler
        handler = handler()
      File ".\ptvs_virtualenv_proxy.py", line 99, in get_virtualenv_handler
        execfile(activate_this, dict(__file__=activate_this))
    IOError: [Errno 2] No such file or directory: 'D:\\home\\site\\wwwroot\\env\\Scripts\\activate_this.py'
    
    
    StdOut: 
    
    StdErr: 
    
    2016-11-10 17:58:34.671000: Unhandled exception in wfastcgi.py: Traceback (most recent call last):
    File "D:\Python27\Scripts\wfastcgi.py", line 711, in main
    env, handler = read_wsgi_handler(response.physical_path)
    File "D:\Python27\Scripts\wfastcgi.py", line 568, in read_wsgi_handler
    return env, get_wsgi_handler(handler_name)
    File "D:\Python27\Scripts\wfastcgi.py", line 541, in get_wsgi_handler
    handler = handler()
    File ".\ptvs_virtualenv_proxy.py", line 99, in get_virtualenv_handler
    execfile(activate_this, dict(__file__=activate_this))
    IOError: [Errno 2] No such file or directory:     
    'D:\\home\\site\\wwwroot\\env\\Scripts\\activate_this.py'
    2016-11-10 17:58:34.687000: wfastcgi.py 2.1.1 closed
    

    这有点奇怪的是我没有将我的env文件夹提交到我的存储库,因为它读取了我的requirements.txt以创建它自己的文件夹。但是,这次似乎没有这样做。

0 个答案:

没有答案