Thursday, January 3, 2013

Twistd (python27) in Windows



1) download
- distribute at http://python-distribute.org/distribute_setup.py
- setuptools at http://pypi.python.org/pypi/setuptools#downloads
- pywin32 (win32api module) at http://sourceforge.net/projects/pywin32/files/pywin32/

2.0) install setuptools (windows installer)
2.1) install pywin32 (windows installer)

3) open cmd.exe
> set PYTHONHOME=c:\Python27
> set PATH=c:\Python27;c:\Python27\Scripts;%PATH%
> python distribute_setup.py (downloaded at step 1)
> easy_install zope.interface
> easy_install pyopenssl

4) download and install pycrypto (windows installer). As of this writing its "PyCrypto 2.6 for Python 2.7" at http://www.voidspace.org.uk/python/modules.shtml#pycrypto

5) download and install twistd (windows installer) at http://twistedmatrix.com/trac/wiki/Downloads

6) create batch file c:\Python27\Scripts\twistd.bat
:: ==== begin twistd.bat  file ========
python %PYTHONHOME%\scripts\twistd.py %*
:: ===== end twistd.bat file ==========

7) add "c:\Python27\Scripts" and "c:\Python27" to PATH variable. Also make sure to set PYTHONHOME to "c:\Python27"

8) test, open cmd.exe
> twistd -n web --path . --port 8083

9) open web browser to localhost:8083