views:

885

answers:

4

I wanted to experiment a little with python 3.0 at home. I got python 3.0 working, I've played around with some scripts, and I thought it would be fun to try to make a small web-project with it.

As I was googling, it turned out, that mod_python, for some reasons, will not be able to support python 3.0.

The only other alternative I've found is mod_wsgi.

On the main page of the mod_wsgi project, it says, that if you want to play with python 3.0, you have to get the latest version from subversion repository. I was wondering, if there is somewhere a pre-built windows binaries available?

If there are no such binaries, then I'd be thankful for any resources about building it with VC++ 2008. Or maybe even general resources about building apache and it's modules with VC++ 2008. Thanks.

Oh and, I'm using the latest Apache 2.2 release.

EDIT: Will it be a problem, if I'll be using the official apache build with my own build of a mod_wsgi (I used depends.exe on apache, and seems that it's not built with VC++ 2008)?

+1  A: 

I would like to find either 2.6 (preferable) or 3.0 (okay) Windows binaries myself, and have looked into this a bit.

There are Windows build steps for mod_wsgi buried deep in the Google Group for it. I think they're out of date; only one person appears to have ever done it and told the world how well it worked out. There may well be problems compiling that require a patch.

I do not think you will need to build your own Apache, or if it matters that the VC++ version is different (though I don't have a ton of evidence for this belief). VC++ version is very important for Python module builds since they rely heavily on the internals of the compiler data structures. I think the Apache module interface is more structured.

You'll probably want to post to the mod_wsgi group if you try this and hit problems, or if you successfully build the modules, please post them as some of us would very much like them but are too busy to get to doing it ourselves :(

kquinn
Please post the link to the post on google groups (if you have it). I already found some interesting stuff (VS2003 solution/project files used to build mod_wsgi for py2.4 and py2.5). Hopefully, I can work my way up from there. It would be nice to see some comments from someone who already did this.
Paulius Maruška
Two useful threads:http://groups.google.com/group/modwsgi/browse_frm/thread/7bce5f6ea02cdfb8/91ca816652b8ebc9http://groups.google.com/group/modwsgi/browse_frm/thread/5fccfc6c774b9d23/9103b878602a7af2
kquinn
The zip file attached to the following page contains a mod_wsgi binary for Python 2.6: http://groups.google.com/group/modwsgi/browse_thread/thread/2c214e9a51603bec
msanders
A: 

For what it is worth, this is still (as of March 2nd 2008) up in the air as far as I can tell. See:

http://groups.google.com/group/modwsgi/browse_thread/thread/93e5e56a04fe37ab/5883f8f6a0fcc945

The same issue - lack of 2.6 binaries for windows - affects mod_python.

I think this pretty much leaves Django users running on Windows locked onto the 2.5 tree... :-(

celopes
Not so. The zip file attached to the following page contains a mod_wsgi binary for Python 2.6: http://groups.google.com/group/modwsgi/browse_thread/thread/2c214e9a51603bec
msanders
+4  A: 

Binaries for Windows are now being supplied from the mod_wsgi site for Apache 2.2 and Python 2.6 and 3.0. Python 3.0 is only supported for mod_wsgi 3.0 onwards. See:

http://code.google.com/p/modwsgi/downloads/list

Graham Dumpleton
Wow! Graham himself... :) My custom builds, for some reason, would prevent apache from loading, so I already gave up on that... Anyway, thank you - I'll finally have something to play with! Official builds FTW! :)
Paulius Maruška
I'm also accepting this answer. It doesn't explain how to build mod_wsgi, but it answers where to get the binaries.
Paulius Maruška
Instructions for building it yourself will be given in mod_wsgi online documentation in time for mod_wsgi 3.0. The third release candidate for mod_wsgi 3.0 already contains makefiles for Apache 2.2 and Python 2.6/3.0 on Windows. You just need to run 'nmake' with '/f' option against appropriate makefile after having changed any paths within it appropriately. The 'nmake' should be run from within the shell window created from menu of Visual Studio as this sets up all the environment correctly to find the compiler etc.
Graham Dumpleton
A: 

I was able to build mod_wsgi for python 2.54 using script prepared by Adal Chirliuc (my python is 2.5 therefore i have to use MSVC7). Using xampp Apache 2.2.14 (it is just a dev machine, for testing purposes):

Instructions:

  1. download http://adal.chiriliuc.com/temp/win32.zip
  2. unpack eg. c:/tmp/modwsgi/win32
  3. download and upack mod_wsgi http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-3.2.tar.gz&can=2&q= into c:/tmp/modwsgi
  4. edit the c:/tmp/modwsgi/win32/generate.py
    • must set correct paths
    • i also commented out the parts for python24
  5. then cd c:/tmp/modwsgi/win32
  6. python generate.py
  7. build.bat

and you can copy mod_wsgi.so to your apache

The relevant part of the generate.py for my settings was:

##### BUILD MACHINE CONFIG #####

VS2003_PATH = r"C:\Program Files\Microsoft Visual Studio .NET 2003"

PYTHON_PATH = {
    # Put None or comment/delete the entry if a particular version is not present
    #24: r"C:\Python24",
    25: r"C:\dev\Python254",
}

APACHE_PATH = {
    # Put None or comment/delete the entry if a particular version is not present
    #20: r"c:\dev\xampp\apache",
    22: r"c:\dev\xampp\apache",
}

##### BUILD MACHINE CONFIG #####

APACHE_LIBS = {
    #20: "libhttpd.lib libapr.lib libaprutil.lib",
    22: "libhttpd.lib libapr-1.lib libaprutil-1.lib",
}
roman
Why not use procedure as described in the mod_wsgi documentation at 'http://code.google.com/p/modwsgi/wiki/InstallationOnWindows#Compiling_From_Source_Code'. As noted however, you will need to copy the win32-ap22py26.mk file to win32-ap22py25.mk and tweak the paths. When you get it working consider posting the updated file back on the mod_wsgi mailing list or issue tracker and it can be incorporated in actual source code.
Graham Dumpleton