鍦╓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浜戝叾瀹冪浉鍏虫枃绔狅紒