A web2py and python newbie here. Tried posting this before, but could not
see this in the posting list.
I tried to do a sample web app with MySQL DB as backend DB. I have created
a table in MySQL separately and populated with values and I want to display
the table values in the UI. I have an error -
"class 'gluon.contrib.pymysql.err.InternalError'> (1050, u"Table
user_details already exists")"
My config files are below:
db.py
if not request.env.web2py_runtime_gae: db =
DAL('mysql://xxxxx',pool_size=1,check_reserved=['all']) else:
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) crud, service, plugins = Crud(db),
Service(), PluginManager() ## create all tables needed by auth if not custom
tables auth.define_tables(username=False, signature=False) ## after defining
tables, uncomment below to enable auditing # auth.enable_record_versioning(db)
db.define_table('user_details', Field('user_id', 'text'), Field('first_name',
'text'), Field('last_name', 'text'), Field('city', 'text'), Field('user_st',
'text'),migrate=True)
My home page look like this
{{ rows = db(db.user_details).select() }} {{if len(rows):}} <ul> {{ for r in
rows: }} <li> {{=r.name}} </li> {{pass}} </ul> {{pass}}
I am not sure what I am missing. Any help appreciated, thanks.
--
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.