使用/ Django的Google App Engine不会渲染960GS

时间:2013-04-06 04:12:28

标签: python django google-app-engine 960.gs

我正在尝试使用GAE(Google App Engine)作为服务器创建网站,并使用GAE Django API呈现网页。我要使用的CSS样式是960 Grid System,特别是here找到的自适应版本。

我的页面正常使用GAE中的Django渲染:

class MainPage(webapp.RequestHandler): 

    def get(self):
        featuredPic = "img/featuredPic.jpg"

        values = {
                  'featuredPic' : featuredPic,
                  }

        self.response.out.write(template.render('index.html', values))


application = webapp.WSGIApplication([('/', MainPage)], debug=True)

我的index.html文件还包含自适应网格系统的代码neccassarry:

<script src="/js/adapt.js"></script>
<script>
    // Edit to suit your needs.
    var ADAPT_CONFIG = {
        // Where is your CSS?
        path : '/css/',

        // false = Only run once, when page first loads.
        // true = Change on window resize and page tilt.
        dynamic : true,

        // First range entry is the minimum.
        // Last range entry is the maximum.
        // Separate ranges by "to" keyword.
        range : [ '0px    to 760px  = mobile.min.css',
                '760px  to 980px  = 720.min.css',
                '980px  to 1280px = 960.min.css',
                '1280px to 1600px = 1200.min.css',
                '1600px to 1940px = 1560.min.css',
                '1940px to 2540px = 1920.min.css',

                '2540px           = 2520.min.css' ]
    };
</script>

此外,我在app.yaml中包含了css,js,img和其他文件夹,但尽管如此,生成的HTML并不遵循我设置为div的960网格系统类。 GAE是否禁用JS或我是否犯了其他错误?

2 个答案:

答案 0 :(得分:2)

实际上,我对GAE并不擅长,但我想,我可以帮助你。

我还在GAE上创建了一个页面,并且还有使用.js和.css文件的模板html文件

在模板html文件中,我编写了如下的脚本标记。

<script type="application/x-javascript" src="iui/iui.js"></script>

我把.js文件放在下面的路径上。

<app_name>\iui\iui.js

<app_name>包含models.py,urls.py,views.py等。

另外,我在app.yaml上添加了以下语句,“muchart”是<app_name>

app.yaml
...
handlers:
- url: /muchart/js
  static_dir: muchart/js

- url: /muchart/iui
  static_dir: muchart/iui

答案 1 :(得分:0)

这并不能完全回答我的问题,但我改为960.gs的继任者,Unsemantic,可在此处获得。它对我的项目非常有效,因为它几乎就是我在960.gs的自适应版本中寻找的东西。我也没有问题设置它。