Connecting a django application to a drupal database?

Posted by Hans on Stack Overflow See other posts from Stack Overflow or by Hans
Published on 2010-05-04T12:43:07Z Indexed on 2010/05/04 12:48 UTC
Read the original article Hit count: 176

Filed under:
|
|
|

I have a 3 - 4000 nodes in a drupal 6 installation on mysql and want to access these data through my django application. I have used manage.py inspectdb to get a skeleton of a model structure. I guess that there are good/historical reasons for drupal's database schemes, but find that there are some hard to understand structure and that there are some challenges in applying django models on the database. Some experiences this far are:

  • node and node revision are intertwined and I solved this by using a OneToOneField (don't need the versions). This meens that the node's body gets accessible through node.vid.body, but it works.
  • Foreign keys need to define the proper db_column to sort out the primary keys.
  • Terms need to use an intermediary table with ManyToManyField.through.
  • Drupal stores both the original and the thumbnailed/resized versions of any image as files in the files table.

Does anyone have experiences in accessing drupal data in django?

  • Are there better solution to for example the node <-> node revision relationship?
  • Drupal stores time/dates as unix-style timestamps in integerfields. Any recommendations? How about time zones?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models