How to use use_library ('django', '1.2')

I am studying development in the Google App Engine.

This is one of the tutorial code, 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 have an almost identical code. I ever get a warning:

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

Can someone please recount the above code with use_library (). I am not sure how to start and where to use use_library and what to do with webapp.

Thanks in advance.

+3
google-app-engine
Jun 30 2018-11-11T00:
source share
3 answers

The above code does not require you to call the use_library function 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' 
+8
Jul 01 2018-11-11T00:
source share

try putting this code on top of your module:

 import os from google.appengine.dist import use_library use_library('django', '1.2') 
+3
Jun 30 2018-11-11T00:
source share

In the current version, this is even easier, since third-party libraries are now listed in app.yaml

 libraries: - name: django version: "1.2" 

You can also use webapp2, which includes the Djangos template engine.

 import webapp2 from google.appengine.ext.webapp2 import template 
+1
Jul 18 '13 at 0:09
source share



All Articles