Tag Archive for 'Apache'

GeoDjango on a Windows server

Deploying GeoDjango projects on a Windows server is obviously possible, but not necessarily the most seamless process one can think of. To get started, there are some great tutorials – at the django project site and here, with some more information about the correct PATH settings – available, that guide you step-by-step through a GeoDjango installation.

Below are some things that I did in addition, did differently, or simply couldn’t do because I never got them to work.

The basics: Django and IIS

IIS is was the web server of choice on the Windows machine in question. Serving Django through IIS is of course doable, there is even a dedicated page on the Django project about it. However, I totally failed in getting Django to work well with IIS. It seemed painfull and eventually made me switch the entire web server to Apache. Django integration with WSGI under Apache is a piece of cake compared to PyISAPIe and IIS if you ask me, up and running in less than 10 minutes.

Virtual Environments

Virtual Environments are great when developing with Python. They give you separated Python installations for every project you work on and avoid interferences with dependencies and installed packages across your projects. Virtual environments is something I’ll really miss on Windows, because I never got it to work correctly. Virtualenv basically creates the correct folder structure and activates a Virtual Environment to work in, but for some reason dependencies in my projects were attempting to access the main Python installation. Which obviously defeats the purpose of Virtual Environments.
What I ended up doing was, using one Django installation and being extremely careful about what goes there. Basically I have to manually validate, check and test that new packages for new projects don’t mess with existing once. Painful, I tell ya.

win-psycopg headache

I ran into serious troubles with psycopg 2.2.1 (the PostgreSQL adapter for Python). My project wouldn’t connect to the PostgreSQL database server at all. I found this entry at stackoverflow, which describes exactly the same issue. The posted solution worked for me too: use psycopg 2.0.14 instead of 2.2.1, no problems so far.

Multiple Django projects in one Apache/WSGI instance

This was the most annoying issue: turned out that only one project at a time was working on the server. That might be an option for the iPhone, but it clearly was unacceptable in my case. The problem caused by the “Python for Windows extensions” is documented in this thread, and my solution, similar to the one posted at the end of the thread, was to install pywin32-212 instead of pywin32-214.

Lessons learned

If you have a choice, get a Linux box to deploy GeoDjango. Anything but .NET seems painful to serve on Windows.

PHP development on Mac OS X

A new version of MAMP, containing the latest updates of its components, is available for download.

MAMP (Macintosh, Apache, Mysql and PHP) is an excelent environment if you’re planning to do some PHP development on your Mac. As they state on the MAMP website, it should therefore not be used as Live Webserver for the Internet.

Included software & libraries

  • Apache Version: 2.0.55
  • MySQL Version: 4.1.12
  • PHP Version: 4.4.2 & 5.1.2
  • eAccelerator: 0.9.4-rc1
  • Zend Optimizer: 2.6.0
  • phpMyAdmin 2.7.0-pl2
  • SQLite Version: 2.8.16
  • SQLiteManager Version: 1.1.3
  • Freetype Version: 2.1.9
  • t1lib Version: 5.1.0
  • curl Version: 7.14.0
  • jpeg Version: 6b
  • libpng Version: 1.2.5
  • gd Version: 2.0.28

I use MAMP primarily to test or modify WordPress upgrades, themes or plugins on my local machine before installing them on my webserver. The installation, administration and removal of MAMP is pretty straightforward – a highly recommended package!