-1

Possible Duplicate:
Does Google App Engine allow creation of files and folders on the server?

I dislike this feature of GAE. Why is that the file-system of GAE is read only ? Sometimes I need to store information in the xml files and sometimes also save some data in text files. Can anyone please explain why GAE offers read only file system ?

Community
  • 1
  • 1
saplingPro
  • 20,769
  • 53
  • 137
  • 195

2 Answers2

2

Remember any App Engine applications may have many copies running on many distinct machines on many datacenters. If you could write a file to the filesystem, the file would then have to be replicated consistently across all running instances and on every new instance created from that moment on.

You may use the blobstore (as Bugs pointed out, which can serve the file by itself without bothering your app), the datastore combined with memcache (this is usually fast enough), Google's Cloud Storage (which is very similar to Amazon's S3 and can also serve the files on its own) or even an external service (such as S3) you access via http.

You can generate the XML file on a string and store it. When someone hit your /myfile.xml, all you need to do is to read it back (from wherever you stored it) and serve it.

rbanffy
  • 2,319
  • 1
  • 16
  • 27
  • So google uses distributed architecture for storing the web-apps ? and what do you mean by _"You can generate the XML file on a string and store it."_ – saplingPro Aug 29 '12 at 03:13
  • App Engine is *very* distributed. Instead of using a file, you can use StringIO (http://docs.python.org/library/stringio.html) and pass file-like object to your XML generator and, when done, extract the contents and store it anywhere but a file. – rbanffy Aug 30 '12 at 02:39
0

Your question's been answered previously. Have a look at Does Google App Engine allow creation of files and folders on the server?

I recommend you use the blobstore (Java, Python, Go ), if you need to store a file permanently.

Community
  • 1
  • 1
Bugs
  • 1,422
  • 1
  • 14
  • 22