原来这个是python的bug
This is a bug of save() function of django.contrib.sessions.backends.file.SessionStore? class. On Windows, os.rename function of Python will raise OSError if the destination file already exists. Whereas on Unix, it will be removed silently. To fix this problem, remove the existing file before renaming if the current operating system is Windows.
根据这个,就得修改下源代码了
django/contrib/sessions/backends/file.py
122 行 加入下面代码的前两行
XML/HTML代码
- if os.name == "nt":
- os.unlink(session_file_name)
- os.rename(output_file_name, session_file_name)
- renamed = True

#1