我正在使用python 2.7.6
falcon ubuntu 14.04
web 框架并尝试运行简单的 hello world 程序。但是在运行此示例时会出现以下错误。对此有任何想法吗?
代码 :
import falcon
class ThingsResource(object):
def on_get(self, req, resp):
"""Handles GET requests"""
resp.status = falcon.HTTP_200
resp.body = 'Hello world!'
# falcon.API instances are callable WSGI apps
wsgi_app = api = falcon.API()
# Resources are represented by long-lived class instances
things = ThingsResource()
# things will handle all requests to the '/things' URL path
api.add_route('/hello', things)
错误:
Traceback (most recent call last):
File "falcon.py", line 1, in <module>
import falcon
File "/home/naresh/Desktop/PythonFramework/falcon.py", line 10, in <module>
wsgi_app = api = falcon.API()
AttributeError: 'module' object has no attribute 'API'