如何使用静态文件与django nonrel [英] How to use static files with django nonrel

查看:99
本文介绍了如何使用静态文件与django nonrel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Django nonrel项目的谷歌应用程序引擎。我按照这里所述设置测试项目。我为静态文件添加了一个名为static的项目的新文件夹。对于app.yaml文件,我添加了这些行;

   -  url:/ static 
static_dir:static

我无法到达我的静态文件。我必须做额外的配置吗?



提前Thx。

解决方案

p> app.yaml 与Django无关,但它配置了App Engine前端。答案取决于您是否要使用Django或前端提供静态文件(这是更好,更便宜和更快)。



如果您只是添加您的 - url:/ static 映射到最后,在之前移动 /.* 通配符由于所有映射从上到下处理 - 首先匹配映射获胜。


I'm trying to use the Django nonrel project for google app engine. I setup the test project as described here. I added a new folder to the project named "static" for my static files. And for the app.yaml file i added the lines;

- url: /static   
static_dir: static

I can't reach my static files. Do i have to do additional configuration?

Thx in advance.

解决方案

app.yaml have nothing to do with Django, but it does configures App Engine front-end. The answer depends on whether you want to serve static files with Django or the front-end (which is, well, cheaper and faster).

If you just "added" your - url: /static mapping to the end, move it before the /.* wildcard. As all mappings processed from top to bottom — first matching mapping wins.

这篇关于如何使用静态文件与django nonrel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆