Does main() need to be in every script containing handlers?
        Posted  
        
            by 
                Will Merydith
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Will Merydith
        
        
        
        Published on 2011-02-05T23:18:54Z
        Indexed on 
            2011/02/06
            23:25 UTC
        
        
        Read the original article
        Hit count: 219
        
Experienced Java programmer trying to learn Python. I have an applicaiton on Google App Engine and want to move my admin Handlers to a separate file. So now I have main.py and admin.py. I've set up app.yaml to route traffic properly, and have added the call to WSGIApplication() in each file to route to the appropriate Handler.
My question is does each script file need def main() and the corresponding if statement:
application = webapp.WSGIApplication([(r'/admin/(.*)', Admin)],
                                       debug=True)
def main():
    run_wsgi_app(application)
if __name__ == '__main__':
    main()
© Stack Overflow or respective owner