Showing posts with label web2py. Show all posts
Showing posts with label web2py. Show all posts

Saturday, November 26, 2011

How to make web2py faster

Avoid regenerating tables:
db = DAL('sqlite://storage.sqlite', migrate=runonce) 

Create indexes:
db.executesql('CREATE INDEX IF NOT EXISTS {table}_index ON {table} (id);'.format(table=table))

Compile byte code in admin

Serve static files direct from server

Move as much logic as possible from models into controllers and modules

Disable session if possible

Cache database queries and controller functions:
db().select(db.log.ALL, cache=(cache.ram, 60))


@cache(request.env.path_info, time_expire=5, cache_model=cache.ram)
def index():
pass

Wednesday, June 30, 2010

web2py on webfaction

In Panel create a custom script and then paste this URL: http://wiki.webfaction.com/wiki/Web2py-LatestSource