Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named jinja2

Using google-app-engine tutorial, I got the following error stack message:

Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 298, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 84, in LoadObject
obj = __import__(path[0])
File "D:\Dev\SandBoxes\web\omaha\omaha.py", line 4, in <module>
import jinja2
ImportError: No module named jinja2

Even though I declared it in the libraries from app.yaml:

application: ***
version: 1
runtime: python27
api_version: 1
threadsafe: true

libraries:
- name: jinja2
  version: latest
- name: webapp2
  version: latest


handlers:
- url: /css
  static_dir: css
- url: /js
  static_dir: js
- url: /img
  static_dir: img
- url: /.*
  script: omaha.application

Has anyone had a similar problem?

like image 776
Cyril Avatar asked Sep 22 '13 13:09

Cyril


3 Answers

In order to use Jinja locally, you need to install it locally

easy_install Jinja2

or

pip install Jinja2
like image 178
topless Avatar answered Oct 21 '22 02:10

topless


Need to restart application in AEL.

The application in Google App Engine Launcher must be restarted for new library calls to be taken into account. I was mislead by the fact all other changes dont need actual restart of the server.

like image 44
Cyril Avatar answered Oct 21 '22 00:10

Cyril


You may not have added the following lines to app.yaml:

- name: jinja2
  version: latest
like image 5
Kees Briggs Avatar answered Oct 21 '22 01:10

Kees Briggs