将Django应用程序部署到azure web应用程序时出现问题

2024-05-02 07:29:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我从未将django项目部署到web应用程序。我通常只是为了好玩而使用localhost构建它们。然而,我现在有一个我正试图部署到Azure Web应用程序中的应用程序,但却一直碰壁。Azure中的部署都是成功的,但是当我访问应用程序域时,我仍然只看到基本页面"Hey, Python developers!"

我已经阅读了一些现有文档,并确保包括一个web.config文件以及一个wsgi.py文件。此外,我还更新了settings.py文件,以包含适当的允许的\u主机。下面是我的django文件夹结构:

|.venv
|naviwebsite
   |accounts
   |naviwebsite
       |settings.py
       |wsgi.py
   |manage.py
|requirements.txt
|web.config

此外,下面是我的web.config文件:

<configuration> <appSettings> <add key="WSGI_HANDLER" value="naviwebsite.wsgi.application"/> <add key="PYTHONPATH" value="D:\home\site\wwwroot"/> <add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/> </appSettings> <system.webServer> <handlers> <add name="PythonHandler" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\python377x64\python.exe|D:\home\python377x64\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/> </handlers> <rewrite> <rules> <rule name="Static Files" stopProcessing="true"> <conditions> <add input="true" pattern="false" /> </conditions> </rule> <rule name="Configure Python" stopProcessing="true"> <match url="(.*)" ignoreCase="false" /> <conditions> <add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" /> </conditions> <action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration>

构成my django应用程序的视图和表单都位于accounts文件夹中。其他人在将django应用程序部署到Azure Linux Web应用程序时是否遇到过类似问题?任何帮助都将不胜感激

多谢各位


Tags: 文件djangopyaddwebconfigtrue应用程序