My site hosted on webfaction started returning a 500 internal server error
this morning and it looks like it's choking on my routing. What's strange
is that it was all working (with no changes made) for quite a while prior
to this. My server log shows this at the start of the problem:
[Thu Sep 27 08:48:16 2012] [notice] caught SIGTERM, shutting down
[Thu Sep 27 08:55:01 2012] [warn] mod_wsgi: Compiled for Python/2.7.1.
[Thu Sep 27 08:55:01 2012] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Thu Sep 27 08:55:01 2012] [notice] Apache/2.2.17 (Unix) mod_wsgi/3.3
Python/2.7.3 configured -- resuming normal operations
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] mod_wsgi (pid=13716):
Target WSGI script '/home/ianwscott/webapps/web2py/web2py/wsgihandler.py'
cannot be loa$
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] mod_wsgi (pid=13716):
Exception occurred processing WSGI script
'/home/ianwscott/webapps/web2py/web2py/wsgiha$
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] File
"/home/ianwscott/webapps/web2py/web2py/wsgihandler.py", line 33, in <module>
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] import gluon.main
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] File
"/home/ianwscott/webapps/web2py/web2py/gluon/main.py", line 114, in <module>
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] rewrite.load()
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] File
"/home/ianwscott/webapps/web2py/web2py/gluon/rewrite.py", line 320, in load
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] load(routes, appname)
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] File
"/home/ianwscott/webapps/web2py/web2py/gluon/rewrite.py", line 262, in load
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] exec (data + '\\n')
in symbols
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] File "<string>", line
14, in <module>
[Thu Sep 27 08:56:03 2012] [error] [client 127.0.0.1] TypeError: 'tuple'
object is not callable
>From then until now any attempt to restart the server generates this same
error with the same traceback.
My routes.py file has these instructions:
default_application = 'blog' # ordinarily set in base routes.py
routes_app = ((r'/(?P<app>admin|blog|peergrades|paideia)\b.*', r'\g<app>'),
(r'(.*)', r'blog'),
(r'/?(.*)', r'blog'))
routes_in = (
# make sure you do not break admin
('/admin','/admin'),
('/admin/$anything','/admin/$anything'),
# make sure you do not break appadmin
('/$app/appadmin','/$app/appadmin'),
('/$app/appadmin/$anything','/$app/appadmin/$anything'),
)
routes_out = (
# make sure you do not break admin
('/admin','/admin'),
('/admin/$anything','/admin/$anything'),
# make sure you do not break appadmin
('/$app/appadmin','/$app/appadmin'),
('/$app/appadmin/$anything','/$app/appadmin/$anything'),
)
logging = 'debug'
Then I have an application specific routes.py file with these rules:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# default_application, default_controller, default_function
# are used when the respective element is missing from the
# (possibly rewritten) incoming URL
routes_in = (
('\b?', '/blog/plugin_blog/index'),
('/', '/blog/plugin_blog/index'),
('/index', '/blog/plugin_blog/index'),
('/index.html', '/blog/plugin_blog/index'),
('/login', '/blog/default/user/login')
('/blog/default/index', '/blog/plugin_blog/index'),
('/articles/$anything', '/blog/plugin_blog/articles/$anything'),
('/classes/$anything', '/blog/plugin_blog/classes/$anything'),
('/new_post', '/blog/plugin_blog/new_post'),
('/edit_post/$anything', '/blog/plugin_blog/edit_post/$anything'),
('/all_posts', '/blog/plugin_blog/all_posts'),
('/new_doc', '/blog/plugin_blog/new_doc'),
# don't break download links
('/blog/default/download/$anything',
'/blog/default/download/$anything'),
# make sure you do not break admin
('/admin', '/admin'),
('/admin/$anything', '/admin/$anything'),
# make sure you do not break appadmin
('/blog/appadmin', '/blog/appadmin'),
('/blog/appadmin/$anything', '/blog/appadmin/$anything')
)
routes_out = (
('/blog/plugin_blog/index', '/'),
('/blog/plugin_blog/articles/$anything', '/articles/$anything'),
('/blog/plugin_blog/classes/$anything', '/classes/$anything'),
('/blog/plugin_blog/new_post', '/new_post'),
('/blog/plugin_blog/edit_post/$anything', '/edit_post/$anything'),
('/blog/plugin_blog/all_posts', '/all_posts'),
('/blog/plugin_blog/new_doc', '/new_doc'),
# don't break download links
('/blog/default/download/$anything',
'/blog/default/download/$anything'),
# make sure you do not break admin
('/admin', '/admin'),
('/admin/$anything', '/admin/$anything'),
# make sure you do not break appadmin
('/blog/appadmin', '/blog/appadmin'),
('/blog/appadmin/$anything', '/blog/appadmin/$anything')
)
Does anyone have any idea what would be causing the error? This is a
production site that has been running fine for about four weeks (1 week
with the routes.py set up more or less this way, 1 day with these specific
settings).
Thanks
--