PJBlog : Pierre-Jean, WinLibre et Cie...

Pierre-Jean Coudert - Logiciels Libres - Développement - etc...

Aller au contenu | Aller au menu | Aller à la recherche

samedi, janvier 29 2011

How to use South to migrate models in a multiple databases Django project

Django 1.2 brings multiple databases handling through the use of database routers. The actual version of South (0.7.3) is not able to handle correctly multiple databases projects out of the box.

Here is a workaround: the idea is to create a new fake django project. And then to use South migration within this project.

 cd head_directory
 django-admin.py startproject my_south_db_project
 cd my_south_db_project

Next,edit my_south_db_project/settings.py

  • we have to set the path correctly to south, to your app and to the corresponding database
  • The only installed apps should be South and your app
 import sys
 import os.path
 current_path = os.path.abspath(os.path.dirname(_ _file_ _))
 head, tail = os.path.split(current_path)
 sys.path.append(os.path.join(head, "my_db_app_dir"))
 sys.path.append(os.path.join(head, "south_sdir"))
 dbpath = os.path.join(head, "my_initial_project_dir")
   'default': {
       'ENGINE': 'django.db.backends.sqlite3',
       'NAME' : os.path.join(dbpath,'my_db_app.sqlite')
       'USER': '',
       'PASSWORD': '',
       'HOST': '',
       'PORT': '',

Create south table in the new db

 ./manage.py syncdb

Now you can work in this project to manage your apps related to this new db

 manage.py convert_to_south my_db_app

on other computers

 manage.py migrate my_db_app 0001 --fake

modify models.py

 manage.py schemamigration my_db_app --auto
 manage.py migrate my_db_app

As you can see, this way you keep the standard South workflow !

Edit: I use this line in the main project's settings.py in order to be able to launch tests:


dimanche, septembre 27 2009

Django code snippets for Notepad++

Here is the content for my Quicktext.ini. This adds Django shortcuts to Notepad++ with the QuickText Plugin.

ie: type model + <TAB> to insert the following model's skeleton:

class ModelName(models.Model):
    """Model docstring"""
    slug = models.SlugField(max_length=200)
    name = models.CharField(max_length=100, default='name')

    updated = models.DateTimeField('update date', auto_now=True )
    created = models.DateTimeField('creation date', auto_now_add=True )

    class Meta:

    def __unicode__(self):
        return name

    def save(self, force_insert=False, force_update=False):

    def get_absolute_url(self):
       return ('view_or_url_name')

class ModelNameAdmin(admin.ModelAdmin):
    list_display = ('name',)
    search_fields = ['name',]

admin.site.register(ModelName, ModelNameAdmin)

Lire la suite...

jeudi, août 20 2009

Django SEO : Link Exchange

I've just published a Django SEO application : Django Link Exchange

This little Django SEO App enables you to manage deep links exchange.

You can edit directly with Django's admin the following informations:

  • Campaigns: site informations
  • Links : anchor, url, additional text
  • Links customization: specific css classes, target, additional javascript (ie: tracker)
  • BackLinks : url, anchor
  • Check Backlinks automatically via Admin's Action (I'm using http://code.google.com/p/scrapemark/ to analyze the backlinking page)

To Install this application, copy it in a directory which is on your PYTHONPATH.

Next, edit your project's settings. and add:

   INSTALLED_APPS += ('link_exchange')

In your template's files:

  • you can publish a link directly in the template with it's name
     {%load link_ex%}
     {%link "name"%}
  • you can publish a link through an object's field containing html AND the {%link "name"%} tag
     {%load link_ex%}
     {% autoescape off %}
     {%evaluate object.textfield%}
     {% endautoescape %}

dimanche, novembre 16 2008

Python Sidebar update

The original Python Sidebar is actually unusable due to the python 2.6 documentation refactoring...

But thanks to Bruno there is now an updated Python 2.6 Sidebar for Firefox.

Click here to bookmark the Python 2.6 Sidebar for Firefox.

samedi, novembre 1 2008

WinLibre Package Manager Hacking session

Here are some pictures from the Mentor Summit 08 sunday's hacking session :



The code repository for this project is : http://code.google.com/p/winlibre/


dimanche, juin 24 2007

Pwytter 0.3 Windows executable

Pwytter is a graphical client for Twitter written in Python / tkInter.

If you want to try this 0.3 release, download the following file, decompress it and double click on pwytter.exe

The source distribution should work on Mac OSX and Linux too.

More info on Pwytter 0.3...

vendredi, juin 22 2007

Pwytter 0.3: soon to be usable

Pwytter is a twitter client written in Python.

pwytter, a twitter client written in Python / tkInter

ChangeLog, release 0.3

  • Collapsable edit parameters (Saved in XML Files)
  • clickable profile and user URLs, Names and Images
  • Improved UI
  • Multi-lines message display and improved word wrap
  • Better path management
  • icons on button (from famfamfam)
  • balloons suport (Hints)
  • Bug corrected in UserTimeLine Display : error 404

Download from SVN

lundi, juin 18 2007

Pwytter 0.2 Screenshot

My Python Twitter client

The UI is written with Tkinter.

Runs actually on windows, and soon on Linux and Mac OS X.


  • User TimeLine
  • Friends TimeLine
  • Public TimeLine

Source Code

Package used

mercredi, novembre 29 2006

How to remove SimpleXMLRPCServer Request logs

This is a simple example intended to show how to remove log messages printed on stderr for each request.

 import SimpleXMLRPCServer
 class NoLogHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
     def log_request(self, code='-', size='-'):
 server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8888), NoLogHandler)
 object = MyObject()

samedi, août 12 2006

Infra Recorder : Gravure CD libre, le Beta test !

Dans le cadre de WinLibre, sponsorisé par le Google Summer of Code, Christian Kindall développe un logiciel libre de gravure de CD pour Windows.

Nous lançons une période de Beta test pour l'aider à finaliser InfraRecorder.


Téléchargez-le, installez-le, testez-le !

Et dîtes ce que vous en pensez sur le forum.


  • Scanner les bus SCSI/IDE pour rechercher les graveurs présents et leurs caractéritiques.
  • Effacer les disques reinscriptibles.
  • Enregistrer une image disque (ISO)
  • Créer des projets de CD de données, audio, mixtes et les enregistrer sur des disques ou créer des images disque
  • Finaliser des disques
  • Copier des disques à la volée
  • Réimporter une session d'un disque multi-sessions et lui ajouter de nouvelles sessions
  • Afficher les informations d'un disque
  • Extraire des données audio et des données vers des fichiers (.wav et .iso)

Autres fonctionnalités

  • Extension Shell : ajout d'options dans le menu contextuel pour enregistrer des images disque et des projets
  • Application complémentaire Express : accès rapide aux fonctions les plus courantes

Digg it ! Fuzz it !

vendredi, juin 24 2005

SiteMap for DotClear

This is a DotClear Extension.

DotClear is a wonderfull, free, open-source blogging software.

This Extension will automatically generate a Google SiteMap's compatible XML file.

The XML file will provide links to:

  • site's index
  • posts
  • categories
  • archives



  • Unzip this file in your DotClear root folder.


modify the following lines in the sitemap.php file:
$conf = array(
"main" => array("display" => true, "refresh" => "always", "priority" => "1.0"),
"post" => array("display" => true, "refresh" => "daily" , "priority" => "0.8"),
"categorie" => array("display" => true, "refresh" => "daily" , "priority" => "0.5"),
"archive" => array("display" => true, "refresh" => "weekly" , "priority" => "0.5")

Submit to Google

samedi, décembre 25 2004

Richard Stallman (RMS) on Porting Free Software to Windows

Just read in LinuxDevCenter.com: Freedom, Innovation, and Convenience: The RMS Interview

FB: Do you think it's a good idea to port a free software project to a proprietary OS such as Windows?

RMS: Porting free applications to nonfree operating systems is often useful. This allows users of those operating systems to try out using a few free programs and see that they can be good to use, that free software won't bite them. This can help people overcome worries about trying a free operating system such as GNU/Linux. Many users really do follow this path.

However, we need to be careful to avoid suggesting that the purpose of free applications is to be used on a proprietary system in that way. Using free applications is a step forward, but it doesn't take you all the way to freedom. To reach that destination, we need to avoid the proprietary software that denies users their freedom.

dimanche, octobre 17 2004

GenIconXP - Free GPL Windows Icon Editor / Generator

French version/Version Française Lire la version française.

GenIconXP logo During the WinLibre development, i was looking for a free/libre multi-resolution icon generator for windows. I didn't find anything interresting. I have decided to write with Delphi an application to convert any image format in a multi-resolution .ICO dile.

The GenIconXP project is licenced under the GPL.

GenIconXP is using the MagickImageObject COM object from the Image Magick project for all images transformations. (More about using this COM object with Delphi (fr))

GenIconXP 0.2

Lire la suite...

mercredi, juillet 21 2004

Winlibre 0.2.2 (en)

WinLibre Today is the release day for WinLibre 0.2.2 which is correcting the few bugs encoutered with WinLibre 0.2.1

- Software update: Gaim 0.80, FileZilla 2.2.7c

- Bugs corrected:

  • install bugs with FireFox and TigntVNC
  • compatibility bug Gaim / Gimp / Gtk
  • download bug with Java (JRE 1.4.2)

- Debug mode added : add /LOG to the command line to create a log file in the Temp directory.


vendredi, juillet 16 2004

Mozilla: My favorite extensions

Here are some of my favorites Mozilla/Firefox extensions: