Hello. I just want to pass subdomain as args(0)
So I have now:
routes_in = (
('.*:https?://(?P<subdomain>.*)\.domain\.ru:.*/?', '/myapp/company/
index/\g<subdomain>'),
('.*:https?://(?P<subdomain>.*)\.domain\.ru:.*/myapp/(?
P<controller>.*)/(?P<function>.*)/?(?P<anything>.*)', '/myapp/
\g<controller>/\g<function>/\g<subdomain>/\g<anything>'),
('/$c/$f', '/managecom/$c/$f'),
)
routes_out = (
('/myapp/company/index/(?P<any>.*)', 'http://\g<any>.domain.ru'),
('/myapp/(?P<controller>.*)/(?P<function>.*)/(?P<subdomain>.*)/?(?
P<anything>.*)', 'http://\g<subdomain>.domain.ru/myapp/\g<controller>/
\g<function>/\g<anything>'),
)
But it does not work like I want.
1)
('.*:https?://(?P<subdomain>.*)\.domain\.ru:.*/?', '/myapp/company/
index/\g<subdomain>'),
this often route on /myapp/company/index/subdomain
but I want it to route only if there are nothing after .ru
for example, mycompany.domain.ru -> /myapp/company/index/mycompany
If I remove :.*/? from domain\.ru:.*/?', this wouldn't work at all.
2)
This line in routes_out
('/myapp/(?P<controller>.*)/(?P<function>.*)/(?P<subdomain>.*)/?(?
P<anything>.*)', 'http://\g<subdomain>.domain.ru/myapp/\g<controller>/
\g<function>/\g<anything>')
should do smth like this:
URL('myapp','controller','function', args['company','someother']) ->
company.domain.ru/myapp/controller/function/someother
If there are no "someother" in args, it works fine. But if there are
other args, it routes in
someother.domain.ru/myapp/controller/function/company
Any suggestions?