How Deploy Django App IIS - python

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

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

Azure website use python3 with django

Officially, Azure Django Websites only support Python 2.7 and Django 1.4, but I am wondering if it is possible to set up an Azure Django website using Python 3.3 and Django 1.6 instead. This official Azure tutorial states:
Note: Windows Azure web sites now come with Python 2.7 and wfastcgi handler
pre-installed. However, web frameworks such as Django are not included. You can
still use a different Python interpreter if you prefer. You just need to include
it in the Git repository and configure the web site to use that interpreter
instead of the Python 2.7 interpreter already installed.
That sounds to me like you can set it up to use a different Python interpreter, although you may have to also provide your own wfastcgi handler and Django installation if you do this. The tutorial also tells you how to point to the location of the interpreter you want to use.
The Python website provides installers, but how would I get everything needed for the Python interpreter into one folder to put in the git repo? Is everything needed already self-contained in /Library/Frameworks/Python.framework/Versions/3.3? What about for Django and wfastcgi? Has anyone else tried this?
It is working now: put python-3.4 in runtime.txt at the root of the project.
See: https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-configure/

Windows with Plesk Panel installs ActiveState Python 2.5.0 - any thoughts?

I expect to run Pylons on a Windows Server 2003 and IIS 6 on a Virtual Private Server (VPS). Most work with the VPS is done through the Plesk 8.6 panel. The Plesk panel has a lot of maintenance advantages for us. However, this Plesk configuration installs ActiveState Python 2.5.0. The Parallels Plesk documents for 8.6 and version 9 insist that only this configuration should be installed.
I'm not eager to settle for the baseline 2.5.0. but don't see any safe upgrade path. How has ActiveState Python 2.5.0 been for other users? Can you replace the Parallels\Plesk\Additional\Python
with another distribution? I don't want to break Plesk, please.
Previously, I followed these instructions, Serving a Pylons app with IIS - Pylons Cookbook
Using the default web site IP address, I had Python 2.6.3 installing the ISAPI-WSGI dll in IIS so that I successfully ran Pylons in a virutalenv through IIS using the IP address, no domain name. I would be so happy if I could run this successful configuration for my domains while I must use Plesk.
Tips and solutions appreciated.
The default Python install location is something like c:\python26. I think it's likely you could install the latest python there, without it conflicting with the ActiveState Python. (You may have to deal with path issues or conflicts over which copy 'owns' python source files in Explorer, though.)

how to configure apache on XP for python 2.6.2 and what do you prefer, python with framework/without?

I am starting python today. It will be my pleasure to have your help.
About a framework - choose the one you'll like. You can find most of them on Python wiki.
About Apache - if you choose a framework, it'll probably have some kind of development web server built-in, with better debugging capabilities than Apache installation. If you really want Apache, then you could install and configure mod_wsgi.
If you are starting Python today, why tackle web development immediately? I'd start off with "hello world" in the console.

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

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

Categories