J'ai un petit peu de code pour afficher un fichierChargement de fichiers dans AppEngine
dans app.yaml
- url: /(.*\.(gif|png|jpg))
static_files: static/\1
upload: static/(.*\.(gif|png|jpg))
dans main.py
...
class ShowImage(webapp.RequestHandler):
def get(self):
rootpath = os.path.dirname(__file__)
file = rootpath + "/static/tracker.gif";
fh=open(file, 'r')
self.response.out.write(fh.read())
fh.close
...
je peux voir la fichiers montés en allant à mon * .appspot.com/tracker.gif (selon le app.yaml) Mais en utilisant * .appspot.com/showimage renvoie
Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 510, in __call__
handler.get(*groups)
File "/base/data/home/apps/APPNAME/2.341131266814384624/main.py", line 170, in get
fh=open(file, 'r')
IOError: [Errno 2] No such file or directory: '/base/data/home/apps/APPNAME/2.341131266814384624/static/tracker.gif'
En fait c'est ma réponse; MSW changeait simplement la mise en forme car je n'avais pas 'formaté' le code –
Mea culpa. Désolé Chris. –