Hi guys,
I thought of using pythonanywhere for the next level of development, so
deployed my code there. I had been using sqlite as a test environment, and
wanted to move to the mysql database that pythonanywhere provides.
I created a new mysql database and then switched the DAL connection to:
db =
DAL('mysql://ykamarjanen:[email protected]/ykamarjanen$DBNAME',pool_size=1,check_reserved=['all'])
After running the web2py I got an error about the database (1005, can't
create table, errno:150). I tried different variations, but could figure
out what is wrong with my table.
Here's my table, that is not created (it has some reserved names, which I
changed):
db.define_table('campaign',
Field('uuid', length=64, default=lambda:str(uuid4())),
Field('name'),
Field('pagename'),
Field('description','text', requires=IS_LENGTH(minsize=20,
maxsize=500)),
Field('created_by_auth','reference auth_user', default=auth.user_id,
readable=False, writable=False),
Field('created_by_participant','reference participant', readable=False,
writable=False),
Field('campaign_type', readable=False, writable=False),
Field('privacy',requires=IS_IN_SET(['open','closed'],zero=T('Choose
privacy')),default='open'),
Field('registration',requires=IS_IN_SET(['open','invitation'],zero=T('Choose
registration')),default='open'),
Field('idea_submit',requires=IS_IN_SET(['anonymous','registered'],zero=T('Choose
how ideas can be sent')),default='anonymous'),
Field('campaign_logo',requires=IS_EMPTY_OR(IS_URL())),
Field('campaign_start','date',requires=IS_DATE(),default=request.now),
Field('campaign_end','date',requires=IS_DATE()),
Field('creation_date','datetime',default=request.now),
Field('twitter_feed','boolean',default=False),
Field('weekly_newsletter',requires=IS_IN_SET(['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],zero=T('Pick
a day for newsletter')),default='Monday'),
Field('weekly_contributor_status','boolean',default=True),
Field('weekly_contributor_nro','integer',requires=IS_IN_SET(range(0,20),zero=T('Select
the number of participants included in the raffle'))),
Field('weekly_contributor_prize_description','text'),
Field('overall_contributor_status','boolean',default=True),
Field('overall_contributor_nro','integer',requires=IS_IN_SET(range(0,20),zero=T('Select
the number of participants included in the raffle'))),
Field('overall_contributor_prize_description','text'),
Field('registered_participant_status','boolean',default=True),
Field('registered_participant_tasks','integer',requires=IS_IN_SET(range(0,20),zero=T('Select
the number of minimum tasks for the prize raffle'))),
Field('registered_participant_description','text'),
Field('free_prize_description','text'),
Field('status',
requires=IS_IN_SET(['waiting','running','halted','ended']), readable=False,
writable=False), #waiting, running, halted, ended
Field('nro_of_participants','integer',default=0, readable=False,
writable=False),
Field('nro_of_ideas','integer',default=0, readable=False,
writable=False),
Field('nro_of_ratings','integer',default=0, readable=False,
writable=False),
Field('nro_of_comments','integer',default=0, readable=False,
writable=False),
Field('additional_settings','text', filter_in=(lambda x:
pickle.dumps(x)), filter_out=(lambda s: s and
pickle.loads(s)),default=None, readable=False, writable=False),
Field('credits_settings','text', filter_in=(lambda x: pickle.dumps(x)),
filter_out=(lambda s: s and pickle.loads(s)),default=None, readable=False,
writable=False),
Field('rating_settings','text', filter_in=(lambda x: pickle.dumps(x)),
filter_out=(lambda s: s and pickle.loads(s)),default=None, readable=False,
writable=False),
Field('process_settings','text', filter_in=(lambda x: pickle.dumps(x)),
filter_out=(lambda s: s and pickle.loads(s)),default=None, readable=False,
writable=False),
Field('path','text', filter_in=(lambda x: pickle.dumps(x)),
filter_out=(lambda s: s and pickle.loads(s)),default=None, readable=False,
writable=False))
Ykä
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.