python - 无法将 django 应用程序部署到 azure web 应用程序
问题描述
我从未将 django 项目部署到 Web 应用程序。我通常只是为了好玩而使用 localhost 构建它们。但是,我现在有一个我正在尝试部署到 Azure Web 应用程序,但一直碰壁。Azure 中的部署都是成功的,但是当我访问应用程序域时,我仍然只能看到基本页面“嘿,Python 开发人员!”
我已经阅读了一些现有的文档,并确保包含 web.config 文件以及使用 wsgi.py 文件。此外,我更新了我的 settings.py 文件以包含适当的 ALLOWED_HOSTS。下面是我的 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>
构成我的 django 应用程序的视图和表单都位于帐户文件夹中。在将他们的 django 应用程序部署到 Azure Linux Web 应用程序时,是否有其他人遇到过类似的问题?任何帮助将不胜感激!
谢谢
解决方案
推荐阅读
- java - 比较 2 个 XML - 一个与实际数据,另一个与动态数据(如 DateTime)的模式
- json - 使用包含数组的列解析熊猫数据框
- c# - Serilog 使用 appsettings.json 而不是 appsettings.Development.json
- python - gspread set_with_dataframe 连接超时。使用 OAuth 客户端 ID
- python - 使用 Python Lambda 处理 AWS Step Function 中的意外错误的最佳实践是什么?
- c# - 通过 Libtiff .NET 编写线性 DNG 时出错
- python - 节点无法读取python保存的文件
- docker - 错误在“/server”中找不到 package.json 文件
- r - 将普通列表转换为 R 中的 nb/spdep 对象?
- python-3.x - 我怎样才能制作目录?