Clone wiki

django-moodle / Home

Getting started: clean URLs

Django provides clean URLs, such as /user/myname/, while Moodle URLs are /user/view.php?id=1234. This annoys me particularly for users, who have a unique username. The Django way gives a much more personal (and less hardcoded) user experience.

My first task was to provide proof of concept clean URLs for user names in Moodle. I've done this with a non-production hack. Basically, I use Django as a man-in-the-middle proxy for serving Moodle pages.

This work has been done in the folder test_moodle_urlmap.


For clean URL requests, Django translates the URL to the corresponding Moodle URL and passes that on to the Moodle server.


Django applies a simple URL translation regular expression to Moodle's response so that when you click on a link on the man-in-the-middle delivered page, the request goes to the man in the middle.

In addition, a few lines have been changed in Moodle so that it delivers clean URLs (in one special case only). This changeset 3677b9cf34a1 makes these changes to Moodle and the proxy.

Other work

On github. skyl has created a django-moodle repository. His present goal is to customize the Django admin interface so that displays Moodle data nicely. Both of us want nice Django models that talk to the Moodle database.

Django support in the external authentication plugin is provided by this Moodle patch.