At least in the 1st generation standard environment (python 2.7) the static files/directories would by default be separated from the application code, one would have to add application_readable: true
to also have a copy together with the app code. See details in the post linked in @lusitanica's comment.
But that's not clearly stated in the 2nd generation handlers
doc. The separation is kinda implied:
All of the files in the given directory are uploaded as static files
and none of them can be run as scripts.
But there's no mentioning of application_readable
. Still, I think it's worth a try, other configs weren't documented for a while but they were working, see comments to this post.
Another thought, assuming that maybe you followed some generic django guide which is typically showing how to server the static content via django - i.e. via the application, not via the CDN-like GAE method (which is how it's served if configured in app.yaml
).
It's likely possible to make it work through app.yaml
. At least I see in Running Django on App Engine Standard Environment. Maybe check your settings.py
, I see in the github version references in the doc:
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_ROOT = 'static'
STATIC_URL = '/static/'
But I'm not a django user, can't help with more details.
If none of the above is working you could also just take the static_dir
config out of the app.yaml
and let django serve the static content. Not optimal, I know - using app CPU cycles.
As for the .txt
file,
Exception Value: /srv/pages\songdatabase1.txt not found
shows a couple of problems:
- you're mixing windows path separator
\
with the *nix one /
. You need the *nix one on GAE, but it's better to just use os.path.join()
instead of manually manipulating the path
- you're using a full path - you should use paths relative to the app top dir (where the
app.yaml
file exists). In your case it should be pages/songdatabase1.txt