【问题标题】:The page isn't redirecting properly - Web2py Admin页面未正确重定向 - Web2py 管理员
【发布时间】:2015-02-15 01:18:59
【问题描述】:

当我访问https://www.myapp.com 时,该网站运行良好。我可以毫无问题地访问每个页面,包括https://www.myapp.com/admin。在管理屏幕上输入密码并单击提交后,页面重定向到https://www.myapp.com/admin/site,并显示以下错误:The page isn't redirecting properly

/home/www-data/web2py/routes.py

routers = dict(
        BASE= dict(
            default_application = 'myapp',
            default_controller = 'default',
            default_function = 'index',
            functions = ['function1', 'function2', ...],
                   )
    )

/etc/apache2/sites-available/default.conf

<VirtualHost *:80>

   RewriteEngine On
   RewriteCond %{HTTPS} !=on
   RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

  CustomLog /var/log/apache2/access.log common
  ErrorLog /var/log/apache2/error.log
</VirtualHost>

/etc/apache2/sites-available/web2py.conf

正如它在文档中显示的那样:http://www.web2py.com/books/default/chapter/34/13/deployment-recipes

什么可能导致这种情况发生?

【问题讨论】:

    标签: apache .htaccess web2py


    【解决方案1】:

    我通过从基于参数的系统切换到基于模式的 routes_in 和 routes_out 解决方案解决了这个问题。我为每个页面定义了路由,然后使用$anything 添加了管理员路由以公开管理员。

    routes_in = (
      ('/', '/myapp/default/index'),
      ('/admin/$anything', '/admin/$anything'),
      ...
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-25
      • 2017-01-18
      • 2011-08-11
      • 2018-06-08
      • 2013-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多