Run Multiple Python mod_wsgi Websites With Apache On Windows

Yes, this sounds completely crazy, but there is a semi-valid need to do this, unfortunately. However, when you need to run multiple Python websites on Apache on Windows via mod_wsgi, it quickly becomes apparent that using the typical <VirtualHost> configuration options do not work as expected.

When you try to do it with a <VirtualHost> configuration, you will be unable to setup a separate WSGIPythonPath configuration setting per virtual host, as that configuration directive is not allowed within a <VirtualHost> node. Instead, you have a single WSGIPythonPath for your entire Apache instance.

If you determine that a single WSGIPythonPath will not work for each website you are hosting separately, the only solution I have found so far is to setup multiple Apache services, each running on its own IP Address/Port combination. If you are running Apache 2.2 on a 64-bit version of Windows, you can run the following to setup a new Apache service:

"%SystemDrive%\Program Files(x86)\Apache Software Group\Apache 2.2\bin\httpd.exe" -k install -n "Apache 2.2-Secondary" -f "%SystemDrive%\Program Files(x86)\Apache Software Group\Apache 2.2\conf\httpd_secondary.conf"

Once the service is installed properly, you just need to make sure to put your configuration options in httpd_secondary.conf and then start the service, and you now have two separate Apache webservers running two separate mod_wsgi Python websites on the same Windows computer.

comments powered by Disqus

Related Posts

Parallax Background Scrolling on Internet Explorer is Not Smooth

One of the pleasures of working on a website that is using some of the latest technologies is that you often run into strange compatability issues that only affect one browser or another, and many of the forums have little to no information about how to properly address the issues. Parallax scrolling is a technique that has been around for a while now, highlighted by Apple’s own iPhone 5s card-esque scrolling on their homepage, among others.

Read More

Apple's iPhone Announcement is a Big Deal for T-Mobile

Every year, we are treated to a big show from Apple about what the next iPhone will be like, and how magical it actually is. In case you have been living under a rock, this major Apple annoucement is one of the largest news-making fancy press-conferences you will see these days. It used to be this way when Microsoft would launch a new operating system, remember that launch announcement and launch party for Windows XP?

Read More

Always Use Automated Integration Testing

QA or Quality Assurance of a software project is often the area of software development that is most neglected. Typically developers avoid software testing like their lives depended on it. While a basic level of testing is required for a single scenario to validate that your code “works”, the level of testing that is required to ensure that all users have a good user experience across all targeted platforms is something that a developer seems to think is beneath them.

Read More