django IIS璁剧疆璁块棶
鍦╓indows鏈嶅姟鍣ㄤ笂锛屼娇鐢↖IS浣滀负Web鏈嶅姟鍣ㄦ墭绠jango搴旂敤锛屼綘闇瑕佽繘琛屼互涓嬫楠よ缃細

瀹夎WfastCGI銆

閰嶇疆IIS銆

璁剧疆web.config鏂囦欢銆

浠ヤ笅鏄竴涓畝鍖栫殑鎸囧鍜岀ず渚嬮厤缃細

瀹夎WfastCGI銆

鎵撳紑鍛戒护鎻愮ず绗︽垨PowerShell锛岃繍琛屼互涓嬪懡浠わ細

pip install wfastcgi

閰嶇疆IIS銆

鍦↖IS绠$悊鍣ㄤ腑锛屽垱寤轰竴涓柊鐨勭綉绔欐垨缂栬緫鐜版湁缃戠珯銆傛寚瀹氱綉绔欑殑鐗╃悊璺緞涓轰綘鐨凞jango椤圭洰鐨勮矾寰勶紙渚嬪锛欳:\MyDjangoProject锛夈

璁剧疆web.config銆

鍦ㄤ綘鐨凞jango椤圭洰鐩綍涓垱寤轰竴涓獁eb.config鏂囦欢锛屽苟濉啓浠ヤ笅鍐呭锛

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python\python.exe|C:\Python\Scripts\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
  </system.webServer>
  <appSettings>
    <!-- Required settings -->
    <add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
    <add key="PYTHONPATH" value="C:\MyDjangoProject" />
    <add key="DJANGO_SETTINGS_MODULE" value="MyDjangoProject.settings" />
    <!-- Optional settings -->
    <add key="WSGI_LOG" value="C:\MyDjangoProject\logs\wfastcgi.log" />
    <add key="WSGI_RESTART_FILE_REGEX" value="" />
  </appSettings>
</configuration>


娉ㄦ剰锛氳灏咰:\Python\python.exe鍜孋:\Python\Scripts\wfastcgi.py鏇挎崲涓轰綘鐨凱ython瀹夎璺緞锛孋:\MyDjangoProject鏇挎崲涓轰綘鐨凞jango椤圭洰璺緞锛孧yDjangoProject.settings鏇挎崲涓轰綘鐨剆ettings妯″潡鍚嶇О銆

瀹屾垚浠ヤ笂姝ラ鍚庯紝浣犵殑Django搴旂敤搴旇鑳藉閫氳繃IIS姝g‘璁块棶浜嗐傝寰楀湪璁剧疆IIS涔嬪悗锛屾鏌jango鐨剆ettings.py鏂囦欢涓殑ALLOWED_HOSTS璁剧疆锛岀‘淇濆寘鍚綘鐨勬湇鍔″櫒IP鎴栧煙鍚嶃傛潵婧愶細

浠ヤ笂灏辨槸django濡備綍鍦 IIS璁剧疆璁块棶鐨勮缁嗗唴瀹癸紝鏇村淇℃伅璇峰叧娉∣D浜戝叾瀹冪浉鍏虫枃绔狅紒



鏈枃URL锛http://www.odweb.cn/news_show.html?id=372