什么是appengine_config.py [英] what is appengine_config.py

查看:104
本文介绍了什么是appengine_config.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名尝试在GAE上构建应用程序的noob。我的应用程序使用超出0.96版支持的django模板功能。我无法使用内置的django 1.2库来获取应用引擎(除了在开发服务器上)。



我相信这篇文章可能会解决我的问题,但我不知道appengine_config.py是什么。我想我应该把它包括在我的项目中,但是在哪里以及如何?除了上面引用的帖子中的代码片段之外,还应该包含哪些内容?



感谢!

解决方案

appengine_config.py位于顶层您的项目由 google.appengine.ext.webapp.util.run_wsgi_app()自动导入,以将中间件添加到Web应用程序。您链接到的片段应该足以载入django 1.2。只需将它粘贴到appengine_config.py和 main.py

中,

pre $ application $ webapp.WSGIApplication([your_mappings])
run_wsgi_app(code $(或者任何地方)应用程序)

请注意,如果您没有在appengine_config.py中加载像appstats这样的中间件,只需将 use_library()调用直接放入main.py;关键是要确保在从给定实例的其他地方加载django之前始终加载它。


I am a noob trying to build an app on GAE. My app uses django templating features beyond those supported in version 0.96. I've not been able to get app engine (other than on the development server) to use the built in django 1.2 libraries.

I believe that this post might solve my problems except I don't know what appengine_config.py is. I assume I should include it in my project, but where and how? What should be in it other than the snippet in the post I referenced above?

Thanks!

解决方案

appengine_config.py at the top level of your project is automatically imported by google.appengine.ext.webapp.util.run_wsgi_app() to add middlewear to webapp applications. The snippet you linked to should be sufficient to load django 1.2.

Simply paste it into appengine_config.py, and in your main.py (or wherever):

application = webapp.WSGIApplication([your_mappings])
run_wsgi_app(application)

Note that if you're not loading middlewear like appstats in appengine_config.py, you can actually just put the use_library() call directly into main.py; the key is to make sure it's always loaded before django is loaded from elsewhere on a given instance.

这篇关于什么是appengine_config.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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