django.core.servers.basehttp.FileWrapper disappears in Django 1.9

非 Y 不嫁゛ 提交于 2020-02-17 18:01:39

问题


I am migrating from django 1.8 to 1.9. and I got the following error:

ImportError: cannot import name 'FileWrapper'

I import it as follow:

from django.core.servers.basehttp import FileWrapper

Searching this name in django 1.9 release notes gives no result. What is the replacement for FileWrapper ?


回答1:


Django just had a wrapper to the wsgiref module you can just get it directly

from wsgiref.util import FileWrapper


来源:https://stackoverflow.com/questions/35817597/django-core-servers-basehttp-filewrapper-disappears-in-django-1-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!