Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python web2pyurl重写_Python_Url Rewriting_Web2py - Fatal编程技术网

Python web2pyurl重写

Python web2pyurl重写,python,url-rewriting,web2py,Python,Url Rewriting,Web2py,我正在玩web2pyurl重写。应用程序的名称是py2manager,我想通过代码在web2py中将其设置为默认值: # vim py2manager/routes.py: routers = dict( BASE = dict( default_application='py2manager', ) ) 但是在web2py重新启动后,我无法访问这个页面(应该与旧页面相同,旧页面可以正常工作)。我再也找不到调试的日志了 我的web2py版本是从git克隆的2.

我正在玩web2pyurl重写。应用程序的名称是
py2manager
,我想通过代码在web2py中将其设置为默认值:

# vim py2manager/routes.py:

routers = dict(
    BASE = dict(
        default_application='py2manager',
    )
)
但是在web2py重新启动后,我无法访问这个页面(应该与旧页面相同,旧页面可以正常工作)。我再也找不到调试的日志了

我的web2py版本是从git克隆的
2.14.6-stable+timestamp.2016.05.09.19.18.48

如何通过省略
py2manager/default
path进行正确的重写


另一方面,正如我使用的doc official man一样,默认函数是
索引
,因此路由器需要更多信息来区分
/index/user/login
(其中
用户
登录
都是
索引
函数的参数)和
/user/login
(其中,
login
用户
函数的参数)。为此,必须在相关控制器中指定函数列表:

routers = dict(
    BASE = dict(
        default_application='py2manager',
    ),
    py2manager = dict(
        default_controller='default',
        default_function='index',
        functions=dict(
            default=['index', 'user', 'list', 'of', 'other', 'functions']
        )
    )
)

此外,如果可能,您应该使用
URL()
函数生成URL,因为它会根据路由器的配置为给定路由生成适当的URL。

可能需要重新加载路由

如果您转到右上角的管理员,在更改管理员密码按钮旁边是重新加载路由按钮