💾 Archived View for chirale.org › 2015-10-10_1303.gmi captured on 2024-05-12 at 15:21:51. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Guide to migrate a Drupal website to Django after the release of Drupal 8

https://web.archive.org/web/20151010000000*/https://www.drupal.org/project/webform

https://web.archive.org/web/20151010000000*/https://www.drupal.org/project/views_datasource

https://web.archive.org/web/20151010000000*/https://www.djangoproject.com/

https://web.archive.org/web/20151010000000*/https://www.python.org/

https://web.archive.org/web/20151010000000*/http://tastypieapi.org/

https://web.archive.org/web/20151010000000*/https://pypi.python.org/pypi

https://web.archive.org/web/20151010000000*/https://www.drupal.org/drupal-8.0.0-rc1

https://web.archive.org/web/20151010000000*/https://www.drupal.org/node/2288521

https://web.archive.org/web/20151010000000*/http://nginx.org/en/

https://web.archive.org/web/20151010000000*/http://gunicorn.org/

https://web.archive.org/web/20151010000000*/http://www.postgresql.org/

https://web.archive.org/web/20151010000000*/http://memcached.org/

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/topics/cache/#memcached

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/topics/cache/#the-per-view-cache

https://web.archive.org/web/20151010000000*/https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ForeignKey

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#inlinemodeladmin-objects

https://web.archive.org/web/20151010000000*/https://www.drupal.org/project/field_collection

https://web.archive.org/web/20151010000000*/https://chirale.wordpress.com/2013/01/25/pair-view-fields-content-on-a-drupal-7-view-quick-howto/

https://web.archive.org/web/20151010000000*/https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc

https://web.archive.org/web/20151010000000*/https://addons.mozilla.org/it/firefox/addon/jsonview/

postdate: &amp;amp;amp;amp;quot;2014-09-17T22:18:42+0200&amp;amp;amp;amp;quot;, nodebody: &amp;amp;amp;amp;quot;HTML TEXT HERE&amp;amp;amp;amp;quot;, nodetype: &amp;amp;amp;amp;quot;drupal type&amp;amp;amp;amp;quot;, nodetitle: &amp;amp;amp;amp;quot;Title here&amp;amp;amp;amp;quot;, nodeauthor: &amp;amp;amp;amp;quot;monty&amp;amp;amp;amp;quot;, nodetags: &amp;amp;amp;amp;quot;Drupal, basketball, paintball&amp;amp;amp;amp;quot; } }, ... ] } </pre> <p>Now you can reach the view appending <em>?nid=0</em> to your path. It means that any node with id greater than 0 will be listed. With <em>nid=0</em> a max of 1000 elements are listed. To get other nodes you have simply to get the nid from the last record (e.g. 2478) and use it as value for the nid parameter obtaining something like <em><a href=

https://web.archive.org/web/20151010000000*/http://example.com/myview?nid=2478

<p>Try it on your browser simulating what a procedure will do for you: check the response size and adapt the number of elements (#4) accordingly to avoid to overload your server, hit the timeout or simply storing too much data into the memory when parsing. When the view response is empty you&#8217;ve listed all nodes matching your filters and the parsing is complete.</p> <p>In this example I&#8217;ve talked about nodes but you can do the same with files, using fid as id to pass as parameter and to sort your rows. In the case of files you have to move the files as well but it&#8217;s pretty simple to import these on a custom model on Django as you will see.</p> <h3>Importing data to Django</h3> <p>Django comes with some nice <a href=

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/ref/django-admin/#dumpdata-app-label-app-label-app-label-model

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/ref/django-admin/#django-admin-loaddata

https://web.archive.org/web/20151010000000*/https://pypi.python.org/pypi/pyaml/

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/

% (sid,) print url response = urllib.urlopen(url) data = json.loads(response.read()) data = data[''] # no data received, empty view result, quit if not data: reading = False break for n, record in enumerate(data): sid = int(record['']['nid']) # ... do something with data ... </pre> <p>In this cycle, sid is the start argument passed to the admin command via command line. Next, sid will be set to the last read record so, when record finishes, a new request to <em>myview</em> starting from the last read element will be made.</p> <p>All input and output is UTF-8 in my case. JSON View quotes strings and you have to decode them before saving in Django:</p> <pre class=

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.CharField

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/ref/models/fields/#textfield

https://web.archive.org/web/20151010000000*/https://docs.djangoproject.com/en/1.8/ref/models/fields/#foreignkey

https://web.archive.org/web/20151010000000*/https://www.google.com/webmasters/tools/crawl-stats

https://web.archive.org/web/20151010000000*/https://chirale.wordpress.com/2015/10/10/guide-to-migrate-a-drupal-website-to-django-after-the-release-of-drupal-8/downloadtime/

https://web.archive.org/web/20151010000000*/https://chirale.org/2018/02/05/why-you-should-not-use-drupal-anymore/

https://web.archive.org/web/20151010000000*/https://www.tiobe.com/tiobe-index/

https://web.archive.org/web/20151010000000*/https://chirale.wordpress.com/2015/10/10/guide-to-migrate-a-drupal-website-to-django-after-the-release-of-drupal-8/django-drupal-trends/