基于Django的Azure Web App在开发服务器运行时被卡住(在Kudu上) [英] Django-based Azure Web App getting stuck when development server is run (on Kudu)

查看:288
本文介绍了基于Django的Azure Web App在开发服务器运行时被卡住(在Kudu上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要将应用从Heroku迁移到Azure,我最近创建了一个Django Azure Web应用程序,将其连接到我的GitHub帐户,并将我现有的应用程序代码通过 git push azure master 。经过一些打嗝后,我收到了所有必需的软件包,以正确安装(打嗝是安装需要



如何让它运行?我的web.config文件如下:

 < configuration> 
< appSettings>
< add key =pythonpathvalue =%SystemDrive%\home\site\wwwroot/>
< add key =WSGI_HANDLERvalue =hostingstart-python.application/>
< add key =DJANGO_SETTINGS_MODULEvalue =unconnectedreddit.settings/>
< / appSettings>
< / configuration>

我的项目称为 unconnectedreddit ,它被放置里面的wwwroot。文件 manage.py Procfile web.config 也被放置在这个级别。 Procfile是Heroku的遗产;它包含有关Heroku上运行的进程的代码,例如: web:newrelic-admin run-program waitress-serve -port = $ PORT unconnectedreddit.wsgi:application



文件夹unconnectedreddit(见附图)包含 settings.py wsgi.py 文件。它还包含一个名为模板的文件夹,以及一个名为 static 的文件夹。



应用程序文件位于链接文件夹(即 models.py views.py forms.py )。



所有包都安装在 env / Lib / site-packages / 中。



有人可以解释我的设置缺少什么,如何纠正?也许这是错误配置的web.config,也许我需要Azure相当于Heroku的Procfile(虽然这对开发服务器来说真的是必要的),也可能是其他的东西。



如果您觉得需要,我会分享更多信息。

解决方案

由于需要绑定到套接字,因此无法运行开发服务器。唯一可访问的端口是80和443,但是,Azure App Service本身已经绑定到这些端口。我建议用wfastcgi配置你的应用程序。有关详细信息,请参阅此示例:
https://github.com/theadriangreen / sample-azure-website-django-app



(注意:这与Django的图库项相同)


To migrate an app from Heroku to Azure, I recently created a Django Azure Web App, connected it to my GitHub account and pushed my existing app code onto it via git push azure master. After some hiccups, I got all required packages to install correctly too (hiccups being installation of packages which required pythonwheels).

I have NOT yet run syncdb on the app (the DB's to be hosted on a separate VM; it's postgresql). But I did try to run env\scripts\python manage.py runserver to see whether the development server would go up. It doesn't; Kudu gets stuck (shown below).

How can I get it to run? My web.config file is as follows:

<configuration>
  <appSettings>
    <add key="pythonpath" value="%SystemDrive%\home\site\wwwroot" />
    <add key="WSGI_HANDLER" value="hostingstart-python.application" />
    <add key="DJANGO_SETTINGS_MODULE" value="unconnectedreddit.settings" />
  </appSettings>
</configuration>

My project is called unconnectedreddit and it's placed inside wwwroot. The files manage.py, Procfile and web.config are placed at this level too. Procfile is a Heroku legacy; it contains code regarding what process to run on Heroku, e.g.: web: newrelic-admin run-program waitress-serve --port=$PORT unconnectedreddit.wsgi:application

The folder unconnectedreddit (see attached image) contains the settings.py and wsgi.py files. It also contains a folder called template, and a folder called static.

The app files are inside the links folder (i.e. models.py, views.py, forms.py).

All packages are installed in env/Lib/site-packages/.

Can someone explain what my setup lacks and how I can rectify it? Perhaps it's the mis-configured web.config, perhaps I need the Azure equivalent of Heroku's Procfile (though is that really necessary for a development server?), or perhaps it's something else.

I'll share more information if you feel you need it.

解决方案

You won't be able to run the development server since it needs to bind to a socket. The only accessible ports are 80 and 443, however, Azure App Service itself is already bound to those. I suggest configuring your app with wfastcgi. See this example for details: https://github.com/theadriangreen/sample-azure-website-django-app

(Note: this is the same as gallery item for Django)

这篇关于基于Django的Azure Web App在开发服务器运行时被卡住(在Kudu上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆