tags:

views:

1486

answers:

2

What would be the best way to port an existing Drupal site to a Django application? I have around 500 pages (mostly books module) and around 50 blog posts. I'm not using any 3rd party modules. I would like to keep the current URLS (for SEO purposes) and migrate database to Django. I will create a simple blog application, so migrating blog posts should be ok. What would be the best way to serve 500+ pages with Django? I would like to use Admin to edit/add new pages.

+7  A: 

All Django development is similar, and yours will fit the pattern.

  1. Define the Django model for your books and blog posts.

  2. Unit test that model using Django's built-in testing capabilities.

  3. Write some small utilities to load your legacy data into Django. At this point, you'll realize that your Django model isn't perfect. Good. Fix it. Fix the tests. Redo the loads.

  4. Configure the default admin interface to your model. At this point, you'll spend time tweaking the admin interface. You'll realize your data model is wrong. Which is a good thing. Fix your model. Fix your tests. Fix your loads.

  5. Now that your data is correct, you can create templates from your legacy pages.

  6. Create URL mappings and view functions to populate the templates from the data model.

Take the time to get the data model right. It really matters, because everything else is very simple if your data model is solid.

S.Lott
Thanks, I have a better picture in my mind now.
Boolean
+2  A: 

It may be possible to write Django models which work with the legacy database (I've done this in the past; see docs on manage.py inspectdb).

However, I'd follow advice above and design a clean database using Django conventions, and then migrate the data over. I usually write migration scripts which write to the new database through Django and read the old one using the raw Python DB APIs (while it is possible to tie Django to multiple databases simultaneously, too).

I also suggest taking a look at the available blogging apps for Django. If the one included in Pinax suits your need, go ahead and use Pinax as a starting point.

akaihola