Your routes do not work for internal links because the last rewriting rule from routes_in have to be also applied to routes_out.
routes_in = (
('/static/$anything', '/myapp/static/$anything'),
('/appadmin/$anything', '/myapp/appadmin/$anything'),
('/favicon.ico', '/myapp/static/favicon.ico'),
('/robots.txt', '/myapp/static/robots.txt'),
('/(.*))', r'/myapp/\1'),
)
routes_out = [(x, y) for (y, x) in routes_in[:-2]]+[('/myapp/(.*))',
r'/\1')]

