Skip to content
Advertisement

Django stops with “generator raised StopIteration” when html form allows for file upload

My setup is Windows 10, Python 3.7, Apache 2.4/mod_wsgi. When I add this enctype="multipart/form-data" in my form (just by adding this attribute, only — no files are attached to the form) I get this error when submitting:

JavaScript

My Django code is this:

JavaScript

And this is full traceback:

JavaScript

Any ideas what is going wrong?

PS: Same django application worked fine in Linux/Nginx/Gunicorn/Python2.7 setup. So, I guess it must some misconfiguration between Django/Python/Apache.

Advertisement

Answer

Your Django is very old and you need to update. This is a Python 3.7 compatibility problem that the Django devs already fixed four years ago, back when it was just a PendingDeprecationWarning on Python 3.5.

In fact, you are on the very last Django version that doesn’t have the fix. Even 1.8.6 has the fix.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement