基本上,我在生产服务器上收到错误 - 大文件无法上传。特别是90MB或更高(虽然错误偶尔发生,即使是8.8MB文件)
通常的堆栈跟踪如下所示:
Stacktrace (most recent call last):
File "django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "mobileapi/decorators.py", line 11, in wrapper
return viewfunc(request, **kwargs)
在我看来,我有一个模型实例,并在上面调用保存...
super(File, self).save(*args, **kwargs)
File "django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "django/db/models/query.py", line 1576, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "django/db/models/sql/compiler.py", line 910, in execute_sql
cursor.execute(sql, params)
File "django/db/backends/mysql/base.py", line 114, in execute
return self.cursor.execute(query, args)
File "MySQLdb/cursors.py", line 155, in execute
charset = db.character_set_name()
我的印象是在设置文件的完整内容之前数据库连接正在关闭。
我已经深入boto库和django-storages库试图调试这个,但无济于事:(
我知道django-stroages s3boto模块提供了多部分上传,但我不确定如何实现这一点。
非常感谢任何帮助。