what is appengine_config.py

2019-04-23 14:49发布

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!

1条回答
forever°为你锁心
2楼-- · 2019-04-23 15:26

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.

查看更多
登录 后发表回答