Since google has a three application limit and you can't easily rename
applications, I have taken to dispatching project from a single
toplevel application:
dispatch.py:
import project1, project2, project3, projectN
def main():
hostname = os.environ['HTTP_HOST']
logging.debug('disptach: ' + hostname + ' ' +
os.environ['REMOTE_ADDR'] + ' ' + time.asctime(time.localtime()) )
if hostname == 'localhost:8080' or hostname == 'localhost:80' or
hostname == 'localhost':
localhost.makepage()
elif hostname == '
domain.net' or hostname == '
www.domain.net':
domain.makepage()
elif hostname == '
project1.domain.net':
project1.makepage()
elif hostname == '
project2.domain.net':
project2.makepage()
elif hostname == '
project3.domain.net':
project3.makepage()
elif hostname == '
projectN.domain.net':
projectN.makepage()
else:
logging.error('disptach: ' + hostname + ' ' +
os.environ['REMOTE_ADDR'] + ' ' + time.asctime(time.localtime()) )
print "no match on the project host"
My question is: does anyone have a convenient solution for
dispatching favicon requests for separate parts of a project or for
multiple projects? I know it's a separate request generated by the
browser; so, all I should really need to do is create a block of code
than handles that URL request and make sure app.yaml maps the request
to the handler instead of a static file:
app.yaml:
- url: /favicon\.ico
script: dispatch.py
project1.py:
def makepage():
logging.debug('
project1.domain.net makepage: ' +
os.environ['REMOTE_ADDR'] + ' ' + time.asctime(time.localtime()) )
application = webapp.WSGIApplication([('/', MainPage),
('/other', OtherPage),
('/favicon\.ico', favicon)
],
debug=False)
wsgiref.handlers.CGIHandler().run(application)
class favicon(webapp.RequestHandler):
def get(self):
What goes here to send back a favicon.ico???!!?!
I'm at a bit of a loss to what code is actually needed to get the
favicon.iso actually delivered back to the browser.
Thanks in advance for any help/suggestion provided...