Django and Elm 0.18 HTTP
Elm 0.18 has just been released. The main new feature is a cool new debugger:
There is also a new http library that has nice support for keeping track of the progress of requests so you can show users progress bars for long running tasks: demo.
I had a bit of trouble getting this to work with Django when updating elvanto mail sync. The requests were working and the data was coming in, but the progress jumped from zero to finished with no intermediate values.
It turn the progress is computed in Elm using the Content-Length
header, but Django doesn’t set this by default. This means that Elm can’t tell us how much data to expect.
Thankfully, the fix is easy, just add 'django.middleware.http.ConditionalGetMiddleware'
to MIDDLEWARE
(or MIDDLEWARE_CLASSES
for Django < 1.10).