Web.py with Google App engine

12 views
Skip to first unread message

Pankaj

unread,
Dec 27, 2008, 2:53:09 PM12/27/08
to web.py
Hi,

I have not been able to use web.py framework with Google App engine.
It errors out while importing templates.
Can anyone point out what am I doing wrong?

Thanks
Pankaj


DETAILS

My project hierarchy:
mysite
-templates
-index.html
-web ( this is the folder 'web' from downloaded web.py tar.
version: 0.31)
-app.yaml
-main.py

-----------------------------------------------------------------------------------------
#main.py
import web

urls = (
'/', 'index',
)

render = web.template.render('templates/')

class index:
def GET(self):
return render.index()

app = web.application(urls, globals())
main = app.cgirun()

-------------------------------------------------------------------------------------------
Error:
Traceback (most recent call last):
File "C:\Dev\GoogleAppEngine\google\appengine\tools
\dev_appserver.py", line 2443, in _HandleRequest
base_env_dict=env_dict)
File "C:\Dev\GoogleAppEngine\google\appengine\tools
\dev_appserver.py", line 353, in Dispatch
base_env_dict=base_env_dict)
File "C:\Dev\GoogleAppEngine\google\appengine\tools
\dev_appserver.py", line 1869, in Dispatch
self._module_dict)
File "C:\Dev\GoogleAppEngine\google\appengine\tools
\dev_appserver.py", line 1787, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "C:\Dev\GoogleAppEngine\google\appengine\tools
\dev_appserver.py", line 1683, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "C:\Dev\workspace\mysite\main.py", line 7, in <module>
render = web.template.render('templates/')
File "C:\Dev\workspace\mysite\web\template.py", line 984, in
__init__
self.mod = __import__(name, None, None, ['x'])
ImportError: No module named templates

Aaron Swartz

unread,
Dec 27, 2008, 3:00:46 PM12/27/08
to we...@googlegroups.com

lxccai

unread,
Dec 29, 2008, 1:01:22 AM12/29/08
to web.py
in dev_appserver.py
EXTRA_PATHS = [
DIR_PATH,
os.path.join(DIR_PATH, 'lib', 'django'),
os.path.join(DIR_PATH, 'lib', 'webob'),
os.path.join(DIR_PATH, 'lib', 'webpy'),////add the line
os.path.join(DIR_PATH, 'lib', 'yaml', 'lib'),
]

Pankaj

unread,
Dec 29, 2008, 8:46:04 AM12/29/08
to web.py
Thanks guys.

Templates needed to be compiled before running the app.
Reply all
Reply to author
Forward
0 new messages