[Fixed]-Are there any good options for baking out a Django site as static files?


django-medusa is largely unmaintained. These are some alternatives mentioned in the project’s README:



I understand your intent, but any decent framework these days offers some sort of caching mecanism that alleviate the pains of dynamic content. With a properly implemented cache, the difference between static and dynamic will be trivial. Trust me.

Happy coding, friend.


A new one has just been announced, though it has existed and been used by its author for quite some time:


I haven’t tried using it yet, but it sure looks good: I will be!


I have a similar setup using Django but on GAE. I have created a build script which I use to build my static HTML files. Since GAE’s version of Django templates is slightly different, this might need some testing.

But essentially you do something like

from django.template import Template, Context
from django.template.loader import get_template

t = get_template('template1.html')   #Need to verify this. GAE template allows me to just call template.render(path, context). Not sure about pure Django templates
c = Context({ 'variable' : 'value'})
with open("file1.html", "w") as f:
    f.write(t.render(c))   #This works for me, but if this doesn't in pure Django, try render_to_string



You are asking for a dynamic site to host in a static environment, that is impossible. The only way is to export all the files, put them into a static server. You can do it with wget, it will copy all the files and convert them to html.

One fallback of this problem is, it can only create html files, if there are links to the pages, ie. search forms etc. will not work, Javascript based linking may not work.


I’m not familiar with anything that will convert an existing django site to a static html site. It might be worth looking at the suite of new django/python PaaS providers. A site like this should be easy to get running on one of these platforms and it should be pretty cheap month to month.

Some providers you might want to checkout include:


Leave a comment