if not request.env.web2py_runtime_gae:
    db = DAL('sqlite://storage.db')
else:
    db = DAL('google:datastore')
    session.connect(request, response, db = db)

response.generic_patterns = ['*'] if request.is_local else []
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()

auth.define_tables(username=True)

mail=auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = '[email protected]'
mail.settings.login = 'username:password'

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
auth.settings.register_next=URL('Gallery')
auth.settings.login_next=URL('Gallery')
auth.settings.logout_next=URL('index')
name=''
mail=''
if auth.user:
    name = auth.user.username
    mail = auth.user.email
else:
    pass

from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth,filename='private/janrain.key')

 
db.define_table('image',
   Field('title', unique=True),
   Field('file', 'upload',autodelete=True),
   Field('votes', 'integer',readable=False,writable=False, default=0),
   Field('voted','list:string',readable=False,writable=False,default=[]),
   Field('uploader',readable=False,writable=False,default=name),
   format = '%(title)s')

db.define_table('comment',
   Field('image_id', db.image),
   Field('author',writable=False,default=name),
   Field('email',writable=False,default=mail),
   Field('body', 'text'))

db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
db.comment.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
db.comment.author.requires = IS_NOT_EMPTY()
db.comment.email.requires = IS_EMAIL()
db.comment.body.requires = IS_NOT_EMPTY()

db.comment.image_id.writable = db.comment.image_id.readable = False
If it helps, this is the db.py module that I have for my app.
Please guide.

On Sunday, September 2, 2012 9:20:39 PM UTC+5:30, entropist wrote:
>
> Hello, I've just started with web2py and I'm trying to learn as much as I 
> can to build functional web applications.
> I'm almost done with my first web2py app, it's a basic photo gallery where 
> one can upload photos visible to other users, with functionalities like 
> comment and like along with photo ratings etc.
> But I noticed a rather peculiar behavior, which slowed down my app 
> tremendously. The storage.sqlite/storage.db file increases in its size 
> mightily with every page load of my app!
> Within a few minutes of using the app, its size reaches around 1GB and 
> goes onto 4-5GB after a while!
>
> With regard to the inner workings, I have images, users and comments 
> databases. Besides, I have heavily tweaked the CSS file, added my own 
> stylesheets and have used some extra jquery modules extensively.
>
> What could be the reason behind such a behavior and how can I get it 
> fixed? Please guide.
>

-- 



Reply via email to