如何使用use_library('django','1.2') [英] How to use use_library('django','1.2')

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

问题描述



这是本教程的其中一段代码, http://code.google.com/appengine/docs/python/gettingstarted/usingwebapp.html

  from google.appengine.ext从google.appengine.ext.webapp.util导入webapp 
导入run_wsgi_app

class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers ['Content-Type'] ='text / plain'
self.response。 out.write('Hello,webapp World!')

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

def main():
run_wsgi_app(应用程序)
$ b如果__name__ ==__main__:
main()

我的代码几乎相同。我有时会收到警告:


警告2011-06-30 13:10:44,443 init .py:851 ]您正在使用默认的Django版本(0.96)。在不久的将来,默认的Django版本将在App Engine版本中发生变化。请调用use_library()来显式选择一个Django版本。有关详情,请参阅 http://code.google.com/appengine /docs/python/tools/libraries.html#Django


任何人都可以使用use_library( )。我不知道如何开始和在哪里使用use_library以及如何处理webapp。



预先感谢。

解决方案

上面的代码不应该要求你直接调用use_library。

如果你在根目录下创建一个新文件您的应用程序目录名为 appengine_config.py ,并添加以下行:

 #使webapp.template使用django 1.2 
webapp_django_version ='1.2'


I'm learning developing in Google App Engine.

This is one of the code from the tutorial, http://code.google.com/appengine/docs/python/gettingstarted/usingwebapp.html

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Hello, webapp World!')

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

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

I've almost identical code. I sometime get warning:

WARNING 2011-06-30 13:10:44,443 init.py:851] You are using the default Django version (0.96). The default Django version will change in an App Engine release in the near future. Please call use_library() to explicitly select a Django version. For more information see http://code.google.com/appengine/docs/python/tools/libraries.html#Django

Can anyone please re factor the above code with use_library(). I'm not sure how to start and where to use use_library and what to do with webapp.

Thanks in advance.

解决方案

The above code should not require you to call use_library directly.

If you create a new file in the root directory of your application named appengine_config.py and add the following line to it:

# Make webapp.template use django 1.2
webapp_django_version = '1.2'

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

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