python - webapp2 DomainRoute is not matching -


i'm trying launch webserver serving several sites under several subdomains. i'm using pythen webapp2 , paste. server behind router asigns static ip adress server , forwards port 80. router has no static ip adress assigned isp i'm using ddns (lets example.dlinkddns.com) . in folder hierarchy each folder represents subdomain , python module.

like this:

server/app.py server/www   server/www/__init__.py server/test   server/test/__init__.py 

they should reachable via www.mydomain.com , test.mydomain.com set *.mydomain.com cname example.dlinkddns.com

this server/app.py:

import sys import os  import webapp2 webapp2_extras import routes  paste import httpserver  domain = 'mydomain.com'  class fallback(webapp2.requesthandler):     def get(self, *args, **kw):         self.response.write('fallback...\n'+str(args)+'\n'+str(kw))  def main():     dirs = [name name in os.listdir(".") if os.path.isdir(name)]     dirs.remove('env') # folder created package virtualenv - needed paste      rs = []     subdomain in dirs:         # import subdomain package         exec('import '+subdomain)         # add routes defined subdomain         exec('rs += [routes.domainroute("'+subdomain+'.'+domain+'", '+subdomain+'.routes)]')     rs += [routes.domainroute("<domain:.*>",[webapp2.route('/<:.*>',fallback,name='fallback')])]      app = webapp2.wsgiapplication(rs)         httpserver.serve(app, host='0.0.0.0', port='80')     if __name__ == '__main__':     main() 

and how www package looks like:

__init__.py import webapp2  class mainmain(webapp2.requesthandler):     def get(self,target):         self.response.write('hello, webapp2! www.mydomain.com at:'+target)  routes = [     webapp2.route('/<target>', handler=mainmain, name='main-main') ] 

the problem is, when visit www.mydomain.com fallback handler seems match mainmain handler should. output

fallback... () {'domain':'0.0.0.0'}. 

it looks app wouldn't recognize domains @ all. same thing happens when visit example.dlinkddns.com. tried without fallback handler showed me 404 page every route , every domain...

i tried start server with

httpserver.serve(app, host='192.168.178.33', port='80') 

this static assigned ip address of server in lan. the output changes to

fallback... () {'domain':'192.168.178.33'}. 

what doing wrong? help!


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -