Installing gevent on shared hosting server

by Mandar Vaze on January 3, 2012
in Python, tips

Recently, I had to install “gevent” python module on webfaction. Normally, I would install it using “pip install gevent” – Very straight forward. But python gevent module requires libevent library, specifically the .so file. This file normally resides in /usr/lib, but on shared host you do not have permissions to write to this location, hence the normal method wouldn’t work.  The trick is to install the .so in custom location, but more importantly, ask pip to use this non-standard location using –install-option command line option

Here are the steps I followed :

wget https://github.com/downloads/libevent/libevent/libevent-1.4.13-stable.tar.gz
tar xvzf libevent-1.4.13-stable.tar.gz
mkdir ~/externals
cd libevent-1.4.13-stable
./configure –prefix=$HOME/externals/
make
make install
pip install –install-option=”-I$HOME/externals/include” –install-option=”-L$HOME/externals/lib” gevent
In the above steps $HOME is taken only as an example, feel free to install it at other locations, and pass the appropriate path to -I and -L as arguments.
While the example above talks about libevent, This method works well for other software as well.

Django 1.2.1 : Page Not Found :/

by Mandar Vaze on September 18, 2010
in Python, Troubleshooting

DjangoThis was my first instance of installing Django and deploying a third party app on it. After deploying the Django-App, I started the app using “python manage.py runserver” It seemed to have started cause I got the following message :

Validating models…
0 errors found

Django version 1.2.1, using settings ‘xxx.settings’
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

But when I visited the page http://127.0.0.1:8000/ (or http://127.0.0.1:8000/admin) I would get “Page Not Found :/” (or “Page Not Found :/admin” – depending on which page I tried to launch) Since I was trying this app for the first time, I suspected that this must be the problem with the app. I checked with other folks who worked on this project, but I couldn’t get any help.  While reading the Django documentation further – I came across an option to “runserver” command where one can start the server on non-default port. As part of troubleshooting, I just tried it, not hoping for much success, but it worked.

Now I am thinking why doesn’t the app work on default port, but works on non-default port. So I stopped the server (running on non-default port) and tried the URL again. I still got the “Page not found” error, and this made it clear that, some other server was listening on port 8000.  Eventually I was find out the process that was listening on port 8000 using the following command :

netstat -ao | findstr LISTENING

Option ‘0′ prints the process ID – I was able to find out the eecutable using ProcExp (which has replaced my Task Manager) On linux – use “grep” in place of “findstr” and “ps” can be used to find out the executable

What surprised me was even though some process is already listening on default port 8000, How did Django “runserver” did not give an error when it tries to bind to port 8000.  This can be reproduced easily by running two instances of same app (or two different apps) from two different terminals. Second instance should fail while binding to default port – and I expect it to show error – But it doesn’t. If it matters I was using Django 1.2.1 on Windows XP (Python 2.6)

All in all, It was very interesting to troubleshoot the problem.

Enhanced by Zemanta

Why SharpDevelop is better IDE ?

SharpDevelop
Image via Wikipedia

In my first post about IronPython, I documented how installing IronPython Studio was painful (Needed Visual Studio shell, which in itself was confusing). When I started with IronPython I did not know about any other IDE, hence I went ahead with IronPython Studio. But later I came to know about SharpDevelop.

My initial problem with SharpDevelop was that it needed .NET 3.5 SP1 at the minimum. I had just gone through the painful exercise of downloading and installing the prerequisites for IronPython Studio. So I was in no mood of downloading another big chunk before I can start my IronPython Development. But once I got past my initial development cycle, I wanted to give Sharp Develop a try.

After using both the ID interchangeably, I finally settled on SharpDevelop as my choice for IronPython Development

Read more..

Next Page »