python - 在 webpy 中使用另一个类

标签 python web.py

我必须在 webpy 中导入另一个类 网页.py

urls = (
    '/', "Home"
)
class Web:

    def __init__(self):
        app = web.application(urls, globals())
        app.run()

home.py

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

谁能告诉我为什么这不起作用?

最佳答案

如果两个文件位于同一文件夹中,那么您可以尝试以下操作:

urls = (
    '/', "home.Home"
)

关于python - 在 webpy 中使用另一个类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12950851/

相关文章:

python - Cython:构建扩展时出错:需要 Microsoft Visual C++ 14.0 或更高版本

python - gevent Open Shift 强制 HTTPS

python - 如何同时运行 PHP 和 Web.py

python - Web.py 无法使用 mod_wsgi 与 Apache 一起使用

python - CookieError : Illegal key value

python - 内容长度被剥离

python - 未找到 SWIG_AsVal_wchar_t 标识符

python - Factory Boy 与 Django ManyToMany 模型

python - 子命令问题 : ctx. invoked_subcommands 始终为 None

python - 在 R 单元、rpy2、Jupyter Notebook 中使用 pandas 数据帧时出错