Forums

web.py issues

Hi,

I am trying to run a simple web.py app, but I get the error "AttributeError: 'module' object has no attribute 'application'". I follow these tutorials:

https://thepathofcode.wordpress.com/2015/01/12/how-to-get-your-web-py-app-running-on-pythonanywhere-com/ https://www.pythonanywhere.com/forums/topic/83/

but doesn't work.

wsgi file:

import sys
#
path = '/home/adolfoguimaraes/web'
if path not in sys.path:
    sys.path.append(path)
#
from simpleexample import app as application

simpleexample.py

import web

urls = (
    '/', 'index'
)

class index:
    def GET(self):
        return "Hello, world!"


app = web.application(urls, globals())
app = app.wsgifunc()

The module that your webapp is in is called web and you're importing web in your simpleexample file, so you're not importing the web.py version of web, you're importing the one that you've created.

Thanks ... I changed the webapp folder name and works.