-
-
Notifications
You must be signed in to change notification settings - Fork 868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google App Engine Issue with Tempfile Library #281
Comments
@pasiorovuo Interesting idea. Note that a bunch of backends use If you have time to work on a PR, I suggest branching off #236 so your changes can be merged after those. (I don't think it's a good idea to combine the two PRs because your change will likely impact more than one backend.) |
I have had this issue before. and my project is in appengine standard environment if you don't wanna use it let's wait for this PR to be merged :) |
I'm sure it is less efficient, but I've just added this monkey patch in appengine_config.py and it allows the library to work just fine. It would be nice to have a more efficient permanent solution
|
Quite a simple and nice solution. I circumvented the issue by writing a custom tempfile.py module that returns StringIO objects. |
@madisona Your fix works great for getting the app to run again, however it interferes with form file uploads.
The difference between the spooled and non-spooled temporary files is the extra 'max_size' parameter that causes a 500 error on form submission. If I find a solution I will post it here! |
@madisona this worked for me too thank you |
@ibrokemycomputer You can make it work by using original version in Python librairies 2.7. Copy https://svn.python.org/projects/python/tags/r27/Lib/tempfile.py into a file tempfile2.py
|
@ibrokemycomputer @cyrilguerard something like this? import tempfile
class SpooledTemporaryFile(tempfile.TemporaryFile):
def __init__(self, *args, **kwargs):
kwargs.pop('max_size', None)
tempfile.TemporaryFile.__init__(*args, **kwargs)
tempfile.SpooledTemporaryFile = SpooledTemporaryFile |
No idea if it can be of any help. After applied the monkey patch suggested from @madisona I kept having the following error:
Now it works fine. |
If this helps anyone, I couldn't create a So instead what worked for me was just: import tempfile
def SpooledTemporaryFile(*args, **kwargs):
kwargs.pop('max_size', None)
return tempfile.TemporaryFile(*args, **kwargs)
tempfile.SpooledTemporaryFile = SpooledTemporaryFile (And, I also needed to install Thanks, all.
|
This is not a real bug, but an issue caused by Google App Engine...
I'm trying to run a Mezzanine CMS app on Google App Engine (with Google Cloud SQL and Google Cloud Storage backends). The app fails on start with
This is caused by a feature in Google App Engine described briefly in here. Python Standard Library tempfile implementation is severely limited, and does not contain SpooledTemporaryFile.
It would be nice to have a way around this and use django-storages with Google App Engine.
The text was updated successfully, but these errors were encountered: