How do you set up a Python WSGI server under IIS? - python

I work in a Windows environment and would prefer to deploy code to IIS. At the same time I would like to code in Python.
Having read that IIS can run fastCGI application, I went to the IIS site where it describes in detail how to get PHP up and running but not much about anything else.
Does anyone have experience getting a Python framework running under IIS using something other that plain old CGI?
If so can you explain to direct me to some instructions on setting this up?

There shouldn't be any need to use FastCGI. There exists a ISAPI extension for WSGI.

Microsoft itself develops wfastcgi (source code) to host Python code on IIS.

We can use iiswsgi framework to setup WSGI over IIS since it is compatible with IIS web server's FastCGI protocol.It's bundled with distutils for building, distribution and installing packages with the help of Microsoft Web Deploy and Web Platform Installer.
For more info refer the following link:
Serving Python WSGI applications natively from IIS

Related

Deploying django(windows) with apache(on unix)

I know it might be a bad design but since we are developing the django website on our laptops which runs Win7, I thought it would be better to run django on a Windows platform only in production.
(Laptop is not powerful enough to run a Unix VM inside and our Unix team doesn't provide any Unix server with UI access (Only Putty) so using an IDE is impossible on Unix.)
I have deployed django with gunicorn and nginx on a Linux server very easily, but this time I have to deploy django on a Windows server with Apache on another Unix server (I know it sucks).
Our middleware team is asking(forcing) to run django components on a separate server so that they can manage their Apache (on Unix) instance comfortably. As far as I understand, Apache and django should reside on the same server for mod_wsgi to work.
Is this possible to keep Apache on a Unix machine and make a django website run from a Windows machine?
If not, what are the best possible solutions in my case? (Switch django on Unix? Use waitress on Django windows? Do not separate Apache and Django? etc.)
Regards,
Aditya
Try deploying on IIS instead, as it is the native Web Server on Windows Servers.
Checkout the django-windowsauth package, you can use it to deploy your project to IIS using few simple commands. https://github.com/danyi1212/django-windowsauth.
The best thing in my modest point of view is to create a unix docker image of your project

Adding a production server to Python Flask in Windows

I have an application setup in Flask and running on localhost in a Windows environment. All of the tutorials I have read said to not use the default Flask server in production.
The production servers Gunicorn and uWSGI both only work in Unix. Is there a way to run either one of those through Windows?
Or do I need to switch the project over to a UNIX development environment?
There's many WSGI servers you can use to serve a Flask application. If you really need to deploy it to Windows, then I did find NWSGI, which might be worth a look.
I think it's fair to say that WSGI servers are few and far between on Windows, as this list only mentioned NWSGI. Unless you have a very good reason to deploy to Windows, I think you're probably better off opting for a *nix environment.
Even with this question answered I wanted to add that you can run wsgi apps on IIS
which is a production level web server.
the easiest example is how flask can run on azure (IIS) but I saw a link explaining it even better https://heejune.me/2015/04/22/running-python-flask-on-a-local-iis-not-azure-with-wfastcgi-py/
Waitress is a pure python solution for both Windows and Nix platforms that is no more complex to set up than the development server.

How Deploy Django App IIS

I am having trouble deploying a simple Django web app to IIS 7 on Windows Server 2008. The app uses Django 1.5 and Python 3.3.
The hang-up seems to be that IIS 7 uses the fcgi (FastCGI) protocol to communicate with web applications and this protocol is not natively supported in Python. All the third party libraries I have tried so far have not worked with Python 3.3. They are:
flup
flup-py3.0
django-windows-tools
PyISAPIe
The Django documentation goes through many of the options above but they are all outdated. What is the best way to deploy this app? Should I try to install Apache on Windows Server 2008 so I can use mod_wsgi? Or is there someway to make it work using regular cgi on IIS? If so, how?
Getting django running on IIS is a headache, so if you are going to go that route I would definitely recommend using python 2.7 which is much better supported than 3.x at the current time.
Here is a somewhat recent tutorial detailing pyISAPIe install on python 2.7, it should be compatible with python 2.7.3 and the latest version of django.
http://blog.wolfplusplus.com/?p=272
If you want to stick with python 3.x on windows then using Apache with mod_wsgi is your best bet.
http://code.google.com/p/modwsgi/wiki/InstallationOnWindows

Execute python script in localhost

I have downloaded and installed python on my PC. I am learning python at this moment so I am a beginner.
Is there anyway I could execute python scripts in localhost (Apache) and view them in a web browser as we do with PHP? I am executing the python scripts from CLI at this moment.
Although there are multiple solutions, I would take a look at mod_python. Unfortunately, in my experience it is not the easiest thing in the world to set up and requires making changes to httpd.conf, but this tutorial is helpful (and gives some examples).
Google App Engine SDK for Python includes a local web server application that simulates the App Engine environment. It allows for instant server script changes by just saving the file and refreshing the browser.
The development tutorial is here
Once you have your web site working locally, it is easy to deploy it live on Google's App Engine servers.

Problem with running Django 1.1.1 on Google App Engine Developement Server

I've downloaded google_appengine version 1.3.1. Using some web tutorials, I've created basic django 1.1.1 application. Using appcfg I managed to deploy it on GAE and it works. The problem is, that application doesn't want to work on dev_appengine.py developement server.
Whenever I run the app GAE local server is returning HTTP 200 without any content. If I set basic environement and run main.py manually, then the page is properly returned on stdout.
I've also created very basic helloworld application, and this one is working ok on the devel server.
Do you have any idea, how can I debug the devel server? Option -d doesn't give any usefull insight at all.
I had module nammed same way as the default GAE launcher (main/ and main.py). After renaming the launcher everything works great.

Categories