Mohit
Mohit

Reputation: 11

how to deploy python app on iis windows server?

hi i am trying to deploy my python app on windows2012 server with iis . i follow the process of add application in website on specific folder than changing handler mapping settings in adding handler script putting python path in it. when i am trying to open it code show me text of app.py instead of running it.

only difference when i tried is that in his python code he started with #!iusr and i started directly have my python code. source where i tried https://www.youtube.com/watch?v=7whncKjSXK0

anyone have any clue thanks for help

Upvotes: 1

Views: 3233

Answers (1)

Jalpa Panchal
Jalpa Panchal

Reputation: 12749

First, create python site for example mine is hello.py and place it under C:\pythonsite folder:

print('Content-Type: text/plain')
print('')
print('Hello, world!')
  • now open iis manager.
  • add a new site. select your python site folder and add bindings.

enter image description here

  • now click on the handler mapping from the middle pane.

enter image description here

  • in the handler mapping window select "add script map" from the action pane.

enter image description here - add below details:

request path: *.py executable: C:\Python37-32\python.exe %s %s name:python

"C:\Python37-32\" is your python folder.

enter image description here

  • click request restrictions and make sure that the checkbox is unchecked.

enter image description here

  • when you click on ok it will open a prompt click "yes".

enter image description here

Note: make sure directory browsing is enabled and your python and site folder has iis_iusrs and iusr permission assigned with full control. you install iis CGI feature.

  • browse the site.

enter image description here

Upvotes: 2

Related Questions