Thursday, 16 May 2013

Local Python development environment

This is a short "howto" on setting up a local development environment, using Python 2.7 with cx_Oracle (against Oracle 11g) and Mongoose web server, on a 64 bit Windows 7 system.

Having set up Oracle Instant Client.

Install Python from ActiveState.
Version: Win 64-bit / x64.

Install cx_Oracle module for Python.
Version: Windows amd64 Installer (Oracle 11g, Python 2.7).

Download and run the Mongoose web server (no installation needed).
Version: mongoose-3.7.exe.

Alter settings, add .py to "cgi_pattern" and add pythonw.exe as cgi_intepreter. Set "document_root" to the root of your web project. You might want to add log files as well (to change settings right click the little Mongoose icon in the system tray menu).
Mongoose settings.

Do you see the Mongoose? Right click it...

You might run into error message:
CGI program sent malformed or too big (>16384 bytes) HTTP headers

In my case this was due to missing cx_Oracle module. Try running your .py script from the command line, and fix any missing library errors:

Traceback (most recent call last):
  File "", line 17, in <module>
    import cx_Oracle
ImportError: No module named cx_Oracle

Start developing
Your web server is located on localhost, so just get started with the development.

All set!

No comments:

Post a Comment

Allowed HTML tags:
<a href="">hyperlink</a>

Please, show the courtesy of identifying yourself when adding a comment. Anonymous comments will, most likely, be removed.