All posts filed under: Python

Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. http://en.wikipedia.org/wiki/Python_(programming_language)

Django and Drupal integration using drush via SSH

Leave a comment
django / Drupal / Howtos / Python

Some months ago I talked about how to achieve a unified login from Django to Drupal using drush. The basic assumption was that both Drupal and Django are on the same server. What if the two components are on different servers? Paramiko is a SSH2 protocol library aimed to provide simple classes to make SSH connection. Let’s see how the code to call drush on command line changes. Prerequisites: paramiko on your app settings.py add: […]

Create nice unicode PDF using Python

Leave a comment
Coding / Howtos / Python

Today I started one of the less motivating activities in Python 2.x: encoding. In Python 3 unicode will be everywhere, but as of the 2.6 version I’ve on one of the server I have to endure. Objective: get data from a UTF-8 encoded json and print a nice PDF. Tools: json, urllib2, fpdf, cgi What you need: pyfpdf: https://code.google.com/p/pyfpdf/downloads/list Download fpdf-1.7.hg.zip or more recent Unzip, enter the directory and python setup.py install locate fpdf cd /usr/lib/python2.6/site-packages/fpdf (or the directory […]

Scrapy on Debian 6

Leave a comment
Howtos / Python

Debian 6 comes with Scrapy 0.8 as downloadable packages on apt. Here a quick howto to get this spider works on Debian 6. sudo apt-get install python-scrapy cd mkdir mydir cd mydir scrapy-ctl startproject anime export SCRAPY_SETTINGS_MODULE=anime.settings export PYTHONPATH=/home/YOURHOMEHERE/mydir If you’ve already a bot but you, to run your spider thanks to point 6 and 7 you can simply type: scrapy-ctl crawl example.com Otherwise, now you can follow the howto on tutorial section of Scrapy 0.8 or […]

Django development on Virtualbox: step by step setup

Leave a comment
Coding / django / Howtos / Python

I had a bad morning trying to repair my Cygwin installation from a virtualenv mess. It’s time to get a Debian and install it on a Virtualbox for my new django project! Windows: host Debian: guest Choosing the distro: what I want Python 2.6 Django 1.4 Apache + Mysql I’m a Debian fan from years so I go to the Debian website and download Wheezy netinst iso (32 bit, since I’m on a 32 bit OS […]

Installing Plone on Debian

Leave a comment
Howtos / Python

A little howto to quickly install and try Plone (a GPL’d CMS based on Zope) on your linux box. Well, the installer seems to do the job nicely. 🙂 Tested on Plone 3.* version, Debian “Lenny”. apt-get install g++ Download latest version of Plone (Unified Installer) Execute: tar zxvf Plone-YOURVERSION-UnifiedInstaller.tgz cd Plone-YOURVERSION-UnifiedInstaller ./install.sh standalone gedit /usr/local/Plone/zinstance/README.txt & gedit /usr/local/Plone/zinstance/buildout.cfg & /usr/local/Plone/zinstance/bin/plonectl start less /usr/local/Plone/zinstance/adminPassword.txt README should be read to follow installation instructions, then you can […]