setup
windows server & iis using FastCGI to handle WSGI apps
assuming you are server / machine admin:
- download or 2012 iso
- install standard with , i used a bootable usb cause of the size (5GB)
- install and configure IIS - web (or available offline here:pdf), credit the guide to James Polera (published 9th March 2015)
- use windows command prompt to install flask (cd\python34\scripts, pip install flask)
- use windows command prompt to start python webapp (cd\python34, python c:\inetpub\wwwroot\site.py)
externally visible IP
default python / flask apps run on localhost (only). to make apps accessible on your machines ip address change python / flask source code to following:app.run(host= '0.0.0.0')...and access via port 5000, eg:
- http://192.168.0.19:5000/ (externally, where 192.168.0.19 is your servers ip address)
- localhost:5000 (locally)
- 127.0.0.1:5000 (also locally)
app.run(host="0.0.0.0", port=5001)
troubleshooting
- turn off windows firewall and windows defender (both enabled by default and block pretty much everything)
- give permissions to creator owner, network service, system, pretty much everyone on the share
enable debug mode
- use windows command prompt, type: SET FLASK_DEBUG=1 (anywhere on C:\, before you launch your site).
- this saves you restarting your python server every time you make a change to your source code..
make a windows batch file
take all of the above, create a new notepad file on server desktop, go.bat and add:SET FLASK_DEBUG=1 CD\PYTHON34 PYTHON C:\inetpub\wwwroot\site.py pauselast line pause gives you the 'Press any key to continue' prompt in DOS.. good for reading errors before the cmd prompt window disappears