Since no response from anyone here, suggest you ask on the web.py mailing list on Google Groups as they are likely to at least understands how the web.py database layer works.
Graham On 24 February 2011 01:33, strattonbrazil <[email protected]> wrote: > I've recently moved from my local web.py/apache setup to a shared host > and I'm trying to match my home configuration. One issue that is > popping up is an OperationalError "MySQL server has gone away". > Searching around the internet, people who come across this error > tended to be inactive for the space of hours. This happens to me > between seconds. > > I've confirmed using mod_wsgi's application() function example that I > am in fact running in daemon mode. One issue though, that concerns me > is that if I spit out web.ctx.orm to the error log, it appears to be a > new object. Shouldn't my sqlalchemy session object be the same > between page requests? > > Here's my python code and a portion of my apache setup. Is there > anything that would cause problems on this new machine I hadn't had > before on my home machine? > > def load_sqla(handler): > web.ctx.orm = scoped_session(sessionmaker(bind=engine)) > try: > try: > return handler() > except web.HTTPError: > web.ctx.orm.commit() > raise > except: > web.ctx.orm.rollback() > raise > finally: > web.ctx.orm.commit() > # If the above alone doesn't work, uncomment > # the following line: > web.ctx.orm.expunge_all() > > > ... urls and controllers ... > > app = web.application(urls, globals(), autoreload=False) > app.add_processor(load_sqla) > application = app.wsgifunc() > > # daemon mode check (this spits out 'app' as I would expect) > #def application(environ, start_response): > # status = '200 OK' > # output = 'mod_wsgi.process_group = %s' % > repr(environ['mod_wsgi.process_group']) > # response_headers = [('Content-type', 'text/plain'), > # ('Content-Length', str(len(output)))] > # start_response(status, response_headers) > # > # return [output] > > #if __name__ == "__main__": > # error("starting main") > # app.run() > > and here's a portion of my apache setup. > > WSGIDaemonProcess app processes=1 threads=1 python-path=/home/net/ > public_html/myapp > WSGIProcessGroup app > WSGIScriptAlias /myapp /home/net/public_html/myapp/managio.py > <Directory "/home/stratton/public_html/myapp"> > Options Indexes MultiViews FollowSymLinks > AllowOverride None > Order allow,deny > allow from all > </Directory> > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
