Hello everyone. I have searched for a solution to my issue but cannot
seem to get anywhere. I have a simple hello world program that works
on the built-in web.py server but once I move to Apache using wsgi I
get import errors. Code is below:
code.py:
-----------------------------------------------
import sys
import os
abspath = os.path.dirname(__file__)
sys.path.append(abspath)
os.chdir(abspath)
print >> sys.stderr, sys.path ## model.py is not here (is that a
problem and if so how to fix?)
import web
import model
#-----------------------------------------------------------------------------
#
urls = (
'/', 'hello'
)
class hello:
def GET(self):
h = model.db()
return h.hi() + " world using web.py with Apache and WSGI."
app = web.application(urls, globals())
view = web.template.render('templates/', base='base')
application = app.wsgifunc()
model.py
-----------------------------------------------------------
class db:
def hi(self):
return "Hello"
And here is the error that I receive
------------------------------------------------------------
<type 'exceptions.AttributeError'> at /
'module' object has no attribute 'db'
Python C:/Apache2.2/htdocs/webpy-test/code.py in GET, line 22
Web GET http://localhost/webpy-test/
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.