Python development on Windows – Setuptools & Pip configuration

Code,Web Development — Mark @ 9:42 pm

Sometimes installing Python modules on Windows is a pain. You have seen the setuptools error message complaining that you don’t have Visual Studio 2003 installed? Yes, well then you have probably seen that the fix is easy:

python setup.py build –compiler=mingw32 install

But what if you want to install using easy_install or pip? or you want to use a pip requirements.txt file in a virtualenv? I have the solution for you.

First: Install MinGw including gcc, make and all the other regular goodies you would have on a Unix system.

Second: Add your \MinGw\bin directory to your path.

Third: If you are using an older version of Python (pre 2.6.6) you will have to manually set your HOME environment variable to your user directory.

Finally: In your C:\Users\Admin (where Admin is your Windows user account, Windows XP users, adjust to \Documents and Settings\ appropriately), create a text file called pydistutils.cfg and paste in the following options:

[build]
compiler = mingw32

That’s it! Enjoy using the magical goodness of pip and easy_install on packages like Twisted, SimpleJson (with speedups) and postgres

Nginx Spawn-fcgi script for Debian

Web Development — Mark @ 3:50 pm

Looking for a script to manage fcgi for you? Props go to SaturnBoy for his script found at http://saturnboy.com/2008/10/nginx-init-script/


#!/bin/bash
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000
PHP_CGI=/usr/bin/spawn-fcgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0
start() {
echo -n "Starting PHP FastCGI: "
start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS
RETVAL=$?
echo "$PHP_CGI_NAME."
}
stop() {
echo -n "Stopping PHP FastCGI: "
killall -q -w -u $USER $PHP_CGI
RETVAL=$?
echo "$PHP_CGI_NAME."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: php-fastcgi {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL

Nginx.conf from

http://elasticdog.com/2008/02/howto-install-wordpress-on-nginx/

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2012 Mark Stahler – Blog | powered by WordPress with Barecity