【发布时间】:2014-06-30 19:43:23
【问题描述】:
我有一个 Windows Azure 网站,在管理控制台中安装了 Python 3.4。这是 web.config:
<configuration>
<appSettings>
<add key="pythonpath" value="D:\home\site\wwwroot\mysite;D:\home\site\wwwroot\site-packages" />
<add key="WSGI_HANDLER" value="django.core.handlers.wsgi.WSGIHandler()" />
<add key="DJANGO_SETTINGS_MODULE" value="core.settings" />
</appSettings>
<system.webServer>
<handlers>
<add name="Python_FastCGI"
path="handler.fcgi"
verb="*"
modules="FastCgiModule"
scriptProcessor="D:\Python34\python.exe|D:\Python34\Scripts\wfastcgi.py"
resourceType="Either"
requireAccess="Script" />
</handlers>
<rewrite>
<rules>
<rule name="Django Application" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
当 fastCGI 配置的 scriptProcessor 属性设置为使用 d:\Python27 时一切正常,但它不适用于 d:\Python34。我已经使用 python 2.7 来验证文件 D:\Python34\python.exe 和 D:\Python34\Scripts\wfastcgi.py 确实存在于服务器上。
编辑:
为了澄清,服务器返回
The page cannot be displayed because an internal server error has occurred.
检查详细日志时,它会显示一条通用的 500 内部服务器错误消息,指向 FastCgiModule。
【问题讨论】:
-
询问如何在 Azure 上运行 Django 就像询问如何在骑独轮车时烤出美味的蛋糕。当然,它是可以做到的,而且在你做的时候它可能看起来很酷,但你真的想日复一日地做吗?可悲的事实是,Windows 上的 Django(因此是 azure)是二等公民。
-
@drz 你能在 azure 中运行 python34,因为我在使用 python27 运行良好时遇到了同样的问题
-
我从来没有让它工作,但几天后我放弃了。也许有人应该开始赏金。