8.1.Integrate IIS with django

  • 1.拷貝專案資料夾到某處, 例如D:\Sean\3DMapWorkflow_Server, 另外新增一個路徑存放web.config, 例如D:\Sean\WorkflowSite

  • 2.編輯web.config, 範例如下:

    • 其中 scriptProcessor 換成 wfastcgi-enable 時出現的那個值

    • PYTHONPATH 則是 wf server 的 manage.py 所在之目錄

    • DJANGO_SETTINGS_MODULE 可以看 manage.py 裡面的值

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration>
      <system.webServer>
      <handlers>
      <add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python36\python.exe|C:\Python36\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
      </handlers>
      <httpErrors errorMode="Detailed" />
      <cgi timeout="00:30:00" />
      </system.webServer>
      <appSettings>
      <add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
      <add key="PYTHONPATH" value="D:\Sean\3DMapWorkflow_Server" />
      <add key="DJANGO_SETTINGS_MODULE" value="MapWorkflow3D.settings" />
      </appSettings>
      </configuration>
  • 3.新增站台:

    • 打開IIS ManagerWork server, 在Server下右鍵 → Add website

      • Physical path: 填入存放web.config的路徑, 例如D:\Sean\WorkflowSite

      • Port: 填入要開放的port

  • 4.更改使用者:

    • 1.在IIS ManagerWork server下選擇Application Pools, 點選剛才新增的站台後, 選擇右方的Advanced Settings

    • 2.更改Process Model/ Identity為電腦的帳號密碼

  • 5.Feature delegation: (可參考 https://docs.microsoft.com/en-us/iis/manage/managing-your-configuration-settings/an-overview-of-feature-delegation-in-iis)

    • IIS ManagerWork server, 在Server下選擇Feature delegation的icon

      • 在列表中點選Feature delegation的icon後, 按右方的Custom Sit Delegation

        • 從'Site'的下拉式選單中找到剛才所新增的站台, 將列表中的所有項目的Delegation都改成Read/Write

Last updated