Django管理员媒体文件在Google App Engine上的位置 [英] Location of Django Admin media files on Google App Engine
问题描述
我正在使用Python 2.7和Django 1.3运行GoogleAppEngine(GAE)1.6.3:
I am running GoogleAppEngine (GAE) 1.6.3 with Python 2.7 and Django 1.3 by having:
libraries:
- name: django
version: "1.3"
在我的的app.yaml
。以下内容应以url / static / admin
为admin管理媒体文件提供:
in my app.yaml
. The following should serve the admin media files at url /static/admin
:
- url: /static/admin
static_dir: django/contrib/admin/media
expiration: '0'
但是,我获得了这样的管理媒体(css等)404。我正在为Django管理员的媒体文件使用正确的位置?
But I get 404s for such admin media (css, etc). Am I using the correct location for the Django admin's media file?
推荐答案
最好的方法是复制或符号链接媒体
目录放入您的本地文件的应用程序目录中,因此它会随应用程序的文件一起上传。然后,您的 app.yaml
可以引用应用程序目录中的相对路径。
The best way to do this is to copy or symlink the media
directory into your app directory in your local files, so it is uploaded with your app's files. Then your app.yaml
can refer to the relative path in the app directory.
有一个 $ PYTHON_LIB
可以在 app.yaml
路径中使用变量替换,但它看起来像Django不在 $ PYTHON_LIB
在实时版本的Python 2.7运行时。
There is a $PYTHON_LIB
variable substitution you can use in app.yaml
paths, but it looks like Django is not under $PYTHON_LIB
in the live version of the Python 2.7 runtime.
这篇关于Django管理员媒体文件在Google App Engine上的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!