Write to a file in the Google App Engine Development server
Posted: Last updated:The App Engine development server tries to mimic the real environment by making it forbidden to write to the filesystem. However, for certain things you might want to do that anyway, for example to log to a file. In that case you can use this code snippet to enable writing to the filesystem:
if os.environ.get('SERVER_SOFTWARE','').startswith('Dev'):
from google.appengine.tools.dev_appserver import FakeFile
FakeFile.ALLOWED_MODES = frozenset(['a','r', 'w', 'rb', 'U', 'rU'])