Note that there are some explanatory texts on larger screens.

plurals
  1. POTemplate Error. Trying to migrate from webapp+python2.5 to webapp2+python2.7.4
    primarykey
    data
    text
    <p>Hello I get the following error when trying to migrate from python2.5/webapp to python2.7.4/webapp2 in Google App Engine. </p> <pre><code>File "C:\main\main.py", in get **compiled_template = template.Template(template_file.read())** File "C:\Program Files (x86)\Google\google_appengine\google\appengine\_internal\django\template\__init__.py", line 156, in __init__ if settings.TEMPLATE_DEBUG and origin is None: File "C:\Program Files (x86)\Google\google_appengine\google\appengine\_internal\django\conf\__init__.py", line 31, in __getattr__ assert self.holder, 'settings has not been configured in this thread' AssertionError: settings has not been configured in this thread </code></pre> <p>Here is the complete code:</p> <hr> <p>main.py file</p> <hr> <pre><code>import webapp2 import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' try: from google.appengine.dist import use_library use_library('django', '1.2') except: pass from django.conf import settings _ = settings.TEMPLATE_DIRS from google.appengine.ext.webapp import template class Main(webapp2.RequestHandler): def get(self): template_values = { 'CURRENT_VERSION_ID': os.environ['CURRENT_VERSION_ID'] } path = os.path.join(os.path.dirname(__file__), './src/main.html'); path = os.path.normpath(path); template_file = open(path) compiled_template = template.Template(template_file.read()) #THIS GIVES THE ERROR template_file.close() self.response.out.write(compiled_template.render(template.Context(template_values))) return app = webapp2.WSGIApplication( [ ('/', Main) ], debug=True ) </code></pre> <hr> <p>app.yaml file</p> <hr> <pre><code>application: main version: 1 runtime: python27 api_version: 1 threadsafe: true derived_file_type: - python_precompiled libraries: - name: yaml version: "3.10" - name: webob version: "1.1.1" - name: webapp2 version: "2.5.2" - name: django version: "1.2" handlers: - url: /.* script: main.app </code></pre> <p>Could you please help with this? Thank you! (Note that the line giving error worked perfectly in webapp+python2.5. It is only after migrating to webapp2+python2.7.4 that I have started seeing this error.)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload