Open ivanscm opened 6 years ago
I don't understand the problem at all, to be honest, but I'm Russian and I might try to help you if you email me a detailed problem description (possibly in Russian). This looks like a question rather than a bug report for me.
BTW For Selectel I strongly suggest to set SWIFT_AUTH_TOKEN_DURATION
to a low value, like 1 hr (3600
), because Selectel doesn't create tokens for a fixed amount of time. Instead, they send back a token lifetime in the X-Expire-Auth-Token
header. According to my observations a newly acquired token lifetime ranges from 5 to 13 hrs, but that seems completely random. We tried to ask them to fix this issue on their side, but they refused to do anything about it, unfortunately.
Does the backend actually re-authenticate now if the token is expired? That did not used to be the case.
Uhm... Ok, I see that since 1.2.18 auth token is handled by swiftclient instead. So for now, I believe, SWIFT_AUTH_TOKEN_DURATION
won't do anything at all (its value is not even referenced in the code). I don't know how swiftclient handles expired tokens, so I can't say if this is still the case for the latest versions. What I was describing was correct for version 1.2.17.
At 1.2.17 the package was re-authenticating after SWIFT_AUTH_TOKEN_DURATION
seconds since previous token creation. If the token expired before that time (i.e. object storage stopped accepting it), you were getting exceptions until SWIFT_AUTH_TOKEN_DURATION
seconds since token creation have passed. And what I was suggesting is to set this value low enough to minimize the risk of having that period of time when token is already expired but SWIFT_AUTH_TOKEN_DURATION
seconds haven't passed yet.
@ivanscm contacted me over email and it seems that he was able to solve his issue.
The problem was that after uploading a file, a python process (the runserver
manage command for local development) was silently crashing. It turns out that the reason was in the wrong version of libmagic
being installed: https://stackoverflow.com/questions/41516138/python-magic-installation-challenges-for-64-bit-windows-10-running-32-bit-python/48790592
Regarding my concern about the token lifetime: I'd suggest to leave it for now until someone else would raise this problem again (feel free to ping me), because I'm currently neither able to check the latest version nor I'm really interested in that.
I think this can be closed.
model
photo = models.ImageField(upload_to='')
and formphoto = forms.ImageField()
and viewfile success upload, db row add, app terminate moment
windows 7x64 django-storage-swift==1.2.18 python 3.6.