Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 284 Vote(s) - 3.6 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to port from Drupal to Django?

#1
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.
Reply

#2
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][2], too).

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


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#3
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.
Reply

#4
[S.Lott answer][1] is still valid after years, I try to complete the analysis with the tools and format to do the job.

There are many Drupal export tools out of there by now but with the very same request I go for [Views Datasource][2] choosing JSON as format. This module is very solid and available for the last version of Drupal. The [JSON][3] format is very fast in both parsing and encoding and it's easy to read and very Python-friendly ([import json][4]).

Using Views Datasource you can create a node view sorted by node id (nid), show a limited number of elements per page, configure a view path, add to it a filter identifier and pass to it the nid to read all elements until you get an empty JSON response.

When importing in Django you have a wide set of tools as well, starting from [loaddata to load fixtures][5]. Views Datasource exported JSON but it's not formatted as Django expects fixtures: you can write a [custom admin command][6] to do the import, where you can have the full control of the import flow.

You can start your command passing a nid=0 as argument and then let the procedure read, import and then fetch data from the next page passing simply the last nid read in the previous HTTP request. You can even restrict access to the path on view but you need additional configuration on the import side.

Regarding performance, just for example I parsed and imported 15.000+ nodes in less than 10 minutes via a Django 1.8 custom admin command on an 8 core / 8 GB Linux virtual machine and [PostgreSQL][7] as DBMS, logging success and error information into a custom model for each node.

These are the basics for import/export between these two platform, for detailed information I described all the [major steps for export from Drupal and then import to Django in this guide][8].


[1]:

[To see links please register here]

[2]:

[To see links please register here]

[3]:

[To see links please register here]

[4]:

[To see links please register here]

[5]:

[To see links please register here]

[6]:

[To see links please register here]

[7]:

[To see links please register here]

[8]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through