Categories
Python

Running django on Site5

It took me an entire day, yes it did! I went here : http://wiki.site5.com/Python/Django/Django_installer. Browsed the forums. No help! Then I started on my own. I noticed that virtual python is loading the modules from the main python lib (/usr/lib/python2.4) instead of the local copy. I imported sys and read the sys.modules list. It pretty much made sense. If python doesn’t run locally (inside the virtual environment), it will try to install easy_install into the server wide path. You can’t achieve that unless you’re the root.

While looking for an alternative, I found virtualenv. It not only worked, it also shipped with a built in easy_install.

Later, when I set things up, I noticed that my app was breaking because Python wasn’t elegant enough to let use codes like this:

Huh! I had to browse the django svn and try all the versions before I got it working. It was a tiring process, but I learned a lot of things! Here’s a quick tutorial for fellow Site5 users:

1) Get Virtualenv from here: http://pypi.python.org/pypi/virtualenv

2) Run this command:

3) The above command will create a virtual python environment for you in “~/bin”. You can now run Python and easy_install by typing:

4) Now get MySQL bindings for Python and the flup package for the FCGI dark spells 😉

5) Now we are ready to rock and roll with Django! Remember, Site5 has Python 2.4. The latest builds of Django might break. Please use the one I used in the following script:

6) Create some Symlinks:

7) Create a dedicated directory for django projects:

8 ) Lets create a project and an app:

9) Create django.fcgi with the following content:

10) Lets finish with a .htaccess to finish it off, should we? 🙂

Categories
Python

Installing IronPython and IronPython Studio

IronPython is an implementation of the Python programming language on the .NET platform. In fact IRON == Implementation Running On .NET 🙂

IronPython allows the programmers to take the advantages provided by Microsoft’s .NET platform while writing codes in a powerful and expressive language like Python. I have been coding Python for a while and decided to try IronPython a bit. I was also looking for a good IDE for Python since I haven’t found any decent free IDEs.

You can install IronPython quite simply. Get the latest binaries from : http://ironpython.net/ and install.

While browsing IronPython resources I found IronPython studio which uses Microsoft Visual Studio 2008 Shell. You just need to get the VS2008 Shell and then install IronPython Studio.

First, get Visual Studio 2008 Shell. The executable you download, it’s a self extracting archive. Run it and it’ll extract the contents to the location you selected. Navigate to that folder and you’ll get the VS2008 Shell installer. When done, get IronPython Studio and install.

The IDE has basic features like code completion, color syntax highlighting, debugging, project and solution management etc.

I have just started with both IronPython and IronPython Studio. Hope the experience is gonna be great 🙂

Categories
Bangla Python

āφāϏ⧁āύ āĻļāĻŋāĻ–āĻŋ āĻĒāĻžāχāĻĨāύ āσ āĻĒāĻžāχāĻĨāύ⧇āϰ āĻ…āύāĻ¨ā§āϝ āϏ⧁āĻ¨ā§āĻĻāϰ āϰāĻžāĻœā§āϝ⧇ āĻļ⧁āϧ⧁ āφāĻĒāύāĻžāϰāĻŋ āĻĒā§āϰāϤ⧀āĻ•ā§āώāĻžā§Ÿ āĻĒāĻžāχāĻĨāύ āĻŦāĻžāĻ‚āϞāĻžāĻĻ⧇āĻļ

āĻĒāĻžāχāĻĨāύ āĻāĻ•āϟāĻŋ āĻĄāĻžā§ŸāύāĻžāĻŽāĻŋāĻ• āĻĒā§āϰ⧋āĻ—ā§āϰāĻžāĻŽāĻŋāĻ‚ āĻ˛ā§āϝāĻžāĻ™ā§āĻ—ā§ā§Ÿā§‡āϜ āϝ⧇āϟāĻŋ āϜ⧟ āĻ•āϰ⧇āϛ⧇ āĻŦāĻšā§ āĻĄā§‡āϭ⧇āϞāĻĒāĻžāϰāĻĻ⧇āϰ āĻšā§ƒāĻĻ⧟ āĨ¤ āĻāϰ āĻŽāĻ§ā§āϝ⧇ āφāϛ⧇ āϗ⧁āĻ—āϞ⧇āϰ āχāĻžā§āϜāĻŋāύāĻŋ⧟āĻžāϰ āϰāĻžāĻ“ āĨ¤ āĻĒāĻžāχāĻĨāύ āĻāĻŽāύ āĻāĻ•āϟāĻŋ āĻ­āĻžāώāĻž āϝāĻžāϰ āĻ—āĻ āύ āĻļ⧈āϞ⧀ āĻ…āύāĻ¨ā§āϝ āĻāĻŦāĻ‚ āĻĒā§āϰāĻ•āĻžāĻļ āĻ­āĻ™ā§āĻ—āĻŋ āϰāϏ āϏāĻŽā§ƒāĻĻā§āϧāĨ¤ āϚāĻŽā§ŽāĻ•āĻžāϰ āĻāχ āĻ˛ā§āϝāĻžāĻ™ā§āĻ—ā§ā§Ÿā§‡āϜāϟāĻŋ āϤāĻžāχ āφāϜ āĻ›ā§œāĻŋā§Ÿā§‡ āĻĒā§œā§‡āϛ⧇ āĻĻāĻŋāĻ• āĻĻāĻŋāĻ—āĻ¨ā§āϤ⧇ āĨ¤ āĻŦāϞāĻžāχ āĻŦāĻžāĻšā§āĻ˛ā§āϝ, āφāĻŽāĻŋāĻ“ āĻāĻ•āϜāύ āĻĒāĻžāχāĻĨāύ āĻĢā§āϝāĻžāύ āĻāĻŦāĻ‚ “āĻĒāĻžāχāĻĨāύāĻŋ⧟āĻžāϰ” āĨ¤ āĻŦāĻžāĻ‚āϞāĻžāĻĻ⧇āĻļ⧇āϰ āĻĄā§‡āϭ⧇āϞāĻĒāĻžāϰāĻĻ⧇āϰ āĻŽāĻ§ā§āϝ⧇ āĻāχ āĻ­āĻžāώāĻžāϟāĻŋ āĻ›ā§œāĻŋā§Ÿā§‡ āĻĻāĻŋāϤ⧇ āϝāĻžāĻ¤ā§āϰāĻž āĻļ⧁āϰ⧁ āĻ•āϰ⧇āϛ⧇ “āĻĒāĻžāχāĻĨāύ āĻŦāĻžāĻ‚āϞāĻžāĻĻ⧇āĻļ“āĨ¤ āφāĻļāĻž āĻ•āϰāĻŋ āĻĒāĻžāχāĻĨāύ⧇āϰ āĻāχ āĻ…āϏāĻŽā§āĻ­āĻŦ āϏ⧁āĻ¨ā§āĻĻāϰ āϜāĻ—āϤ⧇ āφāĻĒāύāĻŋāĻ“ āφāĻŽāĻžāĻĻ⧇āϰ āϏāĻžāĻĨ⧇āχ āĻĨāĻžāĻ•āĻŦ⧇āύ 😀

āĻ•āĻŋāĻ¨ā§āϤ⧁ āĻ­āĻžāĻŦāϛ⧇āύ āϕ⧇āύāχ āĻŦāĻž āĻ•āĻˇā§āϟ āĻ•āϰ⧇ āφāĻŦāĻžāϰ āĻĒāĻžāχāĻĨāύ āĻļāĻŋāĻ–āĻŦ⧇āύ ? āĻ˛ā§āϝāĻžāĻ™ā§āĻ—ā§ā§Ÿā§‡āϜ “āĻāĻ•ā§āϏ” āύāĻŋā§Ÿā§‡āχ āϤ⧋ āĻ­āĻžāϞ āφāϛ⧇āύ! āĻāĻ•āĻŦāĻžāϰ āĻ•āĻŋ āϭ⧇āĻŦ⧇āϛ⧇āύ, āĻ˛ā§āϝāĻžāĻ™ā§āĻ—ā§ā§Ÿā§‡āϜ “āĻāĻ•ā§āϏ” āĻĻāĻŋā§Ÿā§‡ āφāĻĒāύāĻŋ āĻ•āĻŋ āĻ•āĻŋ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŦ⧇āύ ? āĻ“ā§Ÿā§‡āĻŦ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻĄā§‡āϭ⧇āϞāĻĒ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŦ⧇āύ ? āĻĒāĻžāϰāĻŦ⧇āύ āĻ•āĻŋ āĻĄā§‡āĻ¸ā§āĻ•āϟāĻĒ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻŦāĻžāύāĻžāϤ⧇ ? āϏ⧇āϟāĻŋ āĻ•āĻŋ āĻ•ā§āϰāϏ āĻ…āĻĒāĻžāϰ⧇āϟāĻŋāĻ‚ āϏāĻŋāĻ¸ā§āĻŸā§‡āĻŽ āĻ•āĻŽā§āĻĒā§āϝāĻžāϟāĻŋāĻŦāϞ āĻšāĻŦ⧇? āĻāχ āĻ˛ā§āϝāĻžāĻ™ā§āĻ—ā§ā§Ÿā§‡āĻœā§‡ āϞ⧇āĻ–āĻž āϕ⧋āĻĄ āĻ•āĻŋ āϏāĻšāĻœā§‡ āĻĒā§œā§‡ āĻŦā§‹āĻāĻž āϝāĻžā§Ÿ ? āϛ⧋āϟ āĻ–āĻžāϟ āĻ•āĻžāϜ āĻ•āϰāϤ⧇ āĻ•āĻŋ āĻĒāϰāĻŋāĻŽāĻžāύ āϕ⧋āĻĄ āϞāĻŋāĻ–āϤ⧇ āĻšā§Ÿ? āφāĻĒāύāĻŋ āϝ⧇ āϕ⧋āĻĄ āϞ⧇āϖ⧇āύ āϤāĻž āĻ•āĻŋ āφāĻĒāύāĻžāϰ āĻŽāύ⧇āϰ āĻ•āĻĨāĻž āĻŦāϞ⧇? āĻāĻŦāĻžāϰ āφāϏ⧁āύ āĻĻ⧇āĻ–āĻŋ āĻĒāĻžāχāĻĨāύ⧇āϰ āĻŦ⧇āϞāĻžā§Ÿ āĻ•āĻŋ āωāĻ¤ā§āϤāϰ āĻĒāĻžāĻ“ā§ŸāĻž āϝāĻžā§Ÿ āσ

ā§§) āĻĒāĻžāχāĻĨāύ āĻĻāĻŋā§Ÿā§‡ āĻ…āύ⧇āĻ• āĻ•āĻŋāϛ⧁ āĻ•āϰāĻž āϝāĻžā§ŸāĨ¤ āĻĄā§‡āĻ¸ā§āĻ•āϟāĻĒ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ, āĻ“ā§Ÿā§‡āĻŦ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻĨ⧇āϕ⧇ āĻļ⧁āϰ⧁ āĻ•āϰ⧇ āĻĒā§āϞāĻžāĻ—āĻŋāύ āĻ•āĻŋāĻ‚āĻŦāĻž āĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟāĻŋāĻ‚ āĻāϰ āĻ•āĻžāĻœā§‡ āĻĒāĻžāχāĻĨāύ⧇āϰ āĻŦā§āϝāĻžāĻĒāĻ• āĻŦā§āϝāĻŦāĻšāĻžāϰāĨ¤ āĻŽā§‹āĻŦāĻžāχāϞ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻ“ āĻĄā§‡āϭ⧇āϞāĻĒ āĻ•āϰāĻž āϝāĻžā§Ÿ āĻĒāĻžāχāĻĨāύ āĻĻāĻŋā§Ÿā§‡ āĨ¤ āĻŽā§‹āϟ āĻ•āĻĨāĻž, āĻ…āĻ¨ā§āϝ āĻ˛ā§āϝāĻžāĻ™ā§āĻ—ā§ā§Ÿā§‡āϜ āĻĻāĻŋā§Ÿā§‡ āϝāĻž āĻ•āϰāĻž āϝāĻžā§Ÿ āϤāĻžāϰ āϏāĻŦāχ āĻ•āϰāĻž āϝāĻžā§Ÿ āĻĒāĻžāχāĻĨāύ⧇ āĨ¤

⧍) āĻŽā§āϝāĻžāĻ•āĻŋāĻ¨ā§āĻŸā§‹āĻļ āφāϰ āϞāĻŋāύāĻžāĻ•ā§āϏ⧇ āĻĒāĻžāχāĻĨāύ āĻāĻŽāύāĻŋāϤ⧇āχ āĻĻ⧇āĻ“ā§ŸāĻž āĻĨāĻžāϕ⧇ āĨ¤ āωāχāĻ¨ā§āĻĄā§‹āĻœā§‡ āφāĻŽāĻžāĻĻ⧇āϰ āĻāĻ•āϟ⧁ āĻ•āĻˇā§āϟ āĻ•āϰ⧇ āχāĻ¨ā§āϏāϟāϞ āĻ•āϰ⧇ āύāĻŋāϤ⧇ āĻšā§Ÿ āĻāχ āϝāĻž āĨ¤ āĻāϟāĻŋ āϏāĻŽā§āĻĒ⧁āĻ°ā§āύāĻ­āĻžāĻŦ⧇ āĻ•ā§āϰāϏ āĻ…āĻĒāĻžāϰ⧇āϟāĻŋāĻ‚ āϏāĻŋāĻ¸ā§āĻŸā§‡āĻŽ āĻ•āĻŽā§āĻĒā§āϝāĻžāϟāĻŋāĻŦāϞ āĨ¤

ā§Š) āĻšā§āϝāĻž āĨ¤ āϖ⧁āĻŦ āϏāĻšāĻœā§‡āχ āĻĒāĻžāχāĻĨāύ āϕ⧋āĻĄ āĻĒ⧜āĻž āĻ“ āĻŦā§‹āĻāĻž āϝāĻžā§Ÿ āĨ¤ āĻāϰ āϏāĻŋāύāĻŸā§āϝāĻžāĻ•ā§āϏ āĻāϰ āĻ•āĻžāϰāύ⧇āχ āĻāϟāĻŋ āĻāϤāϟāĻž āϏāĻšāϜāĻĒāĻžāĻ ā§āϝ āĨ¤

ā§Ē) āĻ…āĻ¨ā§āϝ āϝ⧇ āϕ⧋āύ āĻ˛ā§āϝāĻžāĻ™ā§āĻ—ā§ā§Ÿā§‡āϜ āĻĨ⧇āϕ⧇ āĻĒāĻžāχāĻĨāύ⧇ āϕ⧋āĻĄ āĻ•āĻŽ āϞāĻŋāϖ⧇āχ āĻ•āĻžāϜ āϏāĻžāϰāĻž āϝāĻžā§Ÿ āĨ¤

ā§Ģ) āφāĻŽāĻžāϰ āĻŽāύ⧇āϰ āĻ•āĻĨāĻž āĻŦāϞ⧇ āφāĻŽāĻžāϰ āϞ⧇āĻ–āĻž āĻĒāĻžāχāĻĨāύ āϕ⧋āĻĄāĨ¤ āφāĻļāĻž āĻ•āϰāĻŋ āφāĻĒāύāĻžāϰ āĻŽāύ⧇āϰ āĻ•āĻĨāĻžāĻ“ āĻŦāϞāĻŦ⧇ āĨ¤ āĻļ⧁āϧ⧁ āĻāĻ•āĻŦāĻžāϰ āĻšā§‡āĻˇā§āϟāĻž āĻ•āϰ⧇āχ āĻĻ⧇āϖ⧇āύ āύāĻž āĨ¤

āϞāĻŋāύāĻžāĻ•ā§āϏ⧇ āĻĒāĻžāχāĻĨāύ⧇āϰ āĻŦā§āϝāĻžāĻĒāĻ• āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻšā§Ÿā§‡ āĻĨāĻžāϕ⧇ āĨ¤ āĻĒāĻžāχāĻĨāύ āϜāĻžāύāĻž āĻĨāĻžāĻ•āϞ⧇ āφāĻĒāύāĻŋ āϏāĻšāĻœā§‡āĻ“ āϞāĻŋāύāĻžāĻ•ā§āϏ⧇ āĻ…āύ⧇āĻ• āĻ•āĻžāϜ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŦ⧇āύ āĻ•āĻŽ āĻĒāϰāĻŋāĻļā§āϰāĻŽā§‡ āĨ¤ āĻœā§āϝāĻžāĻ‚āĻ—ā§‹ āĻĻāĻŋā§Ÿā§‡ āĻŦāĻžāύāĻžāϤ⧇ āĻĒāĻžāϰāĻŦ⧇āύ āĻ“ā§Ÿā§‡āĻŦ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĨ¤ āĻāĻ–āύ āĻ…āĻŦāĻļā§āϝ āϗ⧁āĻ—āϞ āĻāĻĒ āχāĻžā§āϜāĻŋāύ⧇āĻ“ āĻ…āύ⧇āϕ⧇ āĻ“ā§Ÿā§‡āĻŦ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āϞāĻŋāĻ–āϛ⧇āύ āĻĒāĻžāχāĻĨāύ⧇ āĨ¤ āĻŽā§āϝāĻžāĻ• āĻ“āĻāϏ āĻŦāĻž āωāχāĻ¨ā§āĻĄā§‹āϜāϕ⧇āĻ“ āύāĻŋāĻœā§‡āϰ āϞāĻŽā§āĻŦāĻž āϞ⧇āϜ āĻĻāĻŋā§Ÿā§‡ āϜ⧜āĻŋā§Ÿā§‡ āϧāϰāϤ⧇ āĻĒāĻŋāĻ› āĻĒāĻž āĻšāĻšā§āϛ⧇ āύāĻž āĻĒāĻžāχāĻĨāύ āĨ¤ āϗ⧁āĻ—āϞ āĻŦā§āϝāĻžāĻĒāĻ• āĻšāĻžāϰ⧇ āĻĒāĻžāχāĻĨāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰ⧇ āφāϏāϛ⧇ āϤāĻžāĻĻ⧇āϰ āĻŦāĻŋāĻ­āĻŋāĻ¨ā§āύ āĻĒā§āϰ⧋āĻĄāĻžāĻ•ā§āĻŸā§‡ āĨ¤ āφāϜ āĻĒāĻžāχāĻĨāύ āĻļāĻŋāϖ⧇ āύāĻŋāϞ⧇ āĻ•āĻžāϞāϕ⧇ āφāĻĒāύāĻŋ āĻ…āĻ¨ā§āϝāĻĻ⧇āϰ āϚāĻžāχāϤ⧇ āύāĻŋāϏāσāĻ¨ā§āĻĻ⧇āĻšā§‡ āĻāĻ—āĻŋā§Ÿā§‡ āĻĨāĻžāĻ•āĻŦ⧇āύ āĨ¤

āĻ…āύ⧇āϕ⧇āχ āĻĒāĻžāχāĻĨāύ āϭ⧟ āĻĒāĻžāύ āĻāϰ Whitespace āύāĻŋāĻ°ā§āĻ­āϰ āχāύāĻĄā§‡āĻ¨ā§āϟāĻļāύ⧇āϰ āĻ•āĻžāϰāύ⧇ āĨ¤ āĻ…āĻ°ā§āĻĨāĻžā§Ž, āĻĒāĻžāχāĻĨāύ⧇ āϕ⧋āĻĄ āĻŦā§āϞāĻ• āύāĻŋāĻ°ā§āĻĻ⧇āĻļ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āĻ•āĻžāϰāϞāĻŋ āĻŦā§āϰ⧇āϏ ({) āĻŦā§āϝāĻŦāĻšāĻžāϰ āύāĻž āĻ•āϰ⧇ āĻĢāĻžāĻ•āĻž āϝāĻžā§ŸāĻ—āĻž āĻŦāĻž āĻ¸ā§āĻĒ⧇āϏ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž āĻšā§Ÿ āĨ¤ āĻāχ āϜāĻžā§ŸāĻ—āĻžāϟāĻŋāϤ⧇ āĻāϏ⧇ āĻ…āύ⧇āϕ⧇āχ āϖ⧇āχ āĻšāĻžāϰāĻŋā§Ÿā§‡ āĻĢ⧇āϞ⧇āύ āĨ¤ āϭ⧟ āĻĒāĻžāĻŦāĻžāϰ āĻ•āĻŋāĻšā§āϛ⧁ āύ⧇āχ āĨ¤ āĻāĻ•āϟ⧁ āĻ–ā§‡ā§ŸāĻžāϞ āĻ•āϰāϞ⧇ āφāϰ āĻŽāύ āĻĨ⧇āϕ⧇ āĻšā§‡āĻˇā§āϟāĻž āĻ•āϰāϞ⧇ āφāĻĒāύāĻŋāĻ“ āĻšā§Ÿā§‡ āωāĻ āĻŦ⧇āύ āϤ⧁āĻ–ā§‹ā§œ āĻĒāĻžāχāĻĨāύāĻŋ⧟āĻžāϰ āĨ¤ āϤāĻŦ⧇ āφāϰ āĻĻ⧇āϰ⧀ āϕ⧇āύ? āφāϜāχ āϚāϞ⧇ āφāϏ⧁āύ : http://pybangla.appspot.com