Django==1.8
django-audiofield==0.6.4
boto==2.38.0
django-storages==1.1.8
我目前在将音频文件上传到S3时遇到问题。正确上传所有图像。当我尝试上传音频时,我得到: 异常类型:NotImplementedError 异常值:此后端不支持绝对路径。 异常位置:... / lib / python2.7 / site-packages / django / core / files / storage.py在路径115行。
这是追溯的结束......
.../lib/python2.7/site-packages/audiofield/fields.py in _set_audio_converted
filename = self.generate_filename(instance, os.path.basename(getattr(instance, self.name).path)) ...
.../lib/python2.7/site-packages/django/db/models/fields/files.py in _get_path
return self.storage.path(self.name) ...
...c/lib/python2.7/site-packages/django/core/files/storage.py in path
raise NotImplementedError("This backend doesn't support absolute paths.") ...
我认为它也适用于
路径(名称)[来源]¶ 可以使用Python的标准open()打开文件的本地文件系统路径。对于无法从本地文件系统访问的存储系统,这将引发NotImplementedError。
答案 0 :(得分:0)
我有它工作......不完美但它有效。我需要重写部分django-audiofield fields.py。特别是def _rename_audio
和def _set_audio_converted
,因为它们都包含路径方法,如果您不从本地提供静态文件,则该方法不起作用。
答案 1 :(得分:0)
在我的情况下,我收到此错误,因为我有一个额外的Save方法。
[DllImport("user32.dll")]
internal static extern uint SendInput(uint nInputs, [MarshalAs(UnmanagedType.LPArray), In] INPUT[] pInputs, int cbSize);
//main calling method
public static void CLICK()
{
INPUT []i = new INPUT[1];
i[0].type = 0;
i[0].U.mi.time = 0;
i[0].U.mi.dwFlags = MOUSEEVENTF.LEFTDOWN | MOUSEEVENTF.ABSOLUTE;
i[0].U.mi.dwExtraInfo = UIntPtr.Zero;
i[0].U.mi.dx = 1;
i[0].U.mi.dy = 1;
SendInput(1, i, INPUT.Size);
}
[StructLayout(LayoutKind.Sequential)]
public struct INPUT
{
internal uint type;
internal InputUnion U;
internal static int Size
{
get { return Marshal.SizeOf(typeof(INPUT)); }
}
}
[StructLayout(LayoutKind.Explicit)]
internal struct InputUnion
{
[FieldOffset(0)]
internal MOUSEINPUT mi;
[FieldOffset(0)]
internal KEYBDINPUT ki;
[FieldOffset(0)]
internal HARDWAREINPUT hi;
}
[StructLayout(LayoutKind.Sequential)]
internal struct MOUSEINPUT
{
internal long dx;
internal long dy;
internal int mouseData;
internal MOUSEEVENTF dwFlags;
internal uint time;
internal UIntPtr dwExtraInfo;
}
[Flags]
internal enum MOUSEEVENTF : uint
{
ABSOLUTE = 0x8000,
HWHEEL = 0x01000,
MOVE = 0x0001,
MOVE_NOCOALESCE = 0x2000,
LEFTDOWN = 0x0002,
LEFTUP = 0x0004,
RIGHTDOWN = 0x0008,
RIGHTUP = 0x0010,
MIDDLEDOWN = 0x0020,
MIDDLEUP = 0x0040,
VIRTUALDESK = 0x4000,
WHEEL = 0x0800,
XDOWN = 0x0080,
XUP = 0x0100
}
我禁用了图像调整大小和保存方法后,错误消息消失了。