Hi everyone,
Is there a step by step guide on how to create a MySQL based Web2Py app?

I've been doing fine with SQLite so far, but my db is getting bigger and I
need to move on.

I tried to do it myself but I must be missing something. I already created
a db in MySQL and I'm trying to create an app that connects to it from
scratch but it does not work:

First I tried to do it with the "Application Wizard" (I know it is
experimental) inserting the uri 'mysql://root:web2py@localhost/test3' in
the "Database Uri:" entry. Even though it did not complain at all,
eventually a storage.sqlite file was created in the 'databases' folder.

So I stopped the server, removed the files from databases folder and
modified the uri in "appconfig.init" uri from "uri =
sqlite://storage.sqlite" to "uri = mysql://root:web2py@localhost/test3".
But then, when I start the server again I get the following error:

<type 'exceptions.RuntimeError'> Failure to connect, tried 5 times:
Traceback (most recent call last): File
"C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py\gluon\packages\dal\pydal\base.py",
line 455, in __init__ self._adapter = adapter(**kwargs) File
"C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py\gluon\packages\dal\pydal\adapters\__init__.py",
line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args,
**kwargs) File
"C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py\gluon\packages\dal\pydal\adapters\base.py",
line 369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs)
File
"C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py\gluon\packages\dal\pydal\adapters\base.py",
line 53, in __init__ self.reconnect() File
"C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py\gluon\packages\dal\pydal\connection.py",
line 172, in reconnect self.connection = self.connector() File
"C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py\gluon\packages\dal\pydal\adapters\mysql.py",
line 52, in connector return self.driver.connect(**self.driver_args) File
"MySQLdb/__init__.py", line 81, in Connect File "MySQLdb/connections.py",
line 193, in __init__ OperationalError: (1251, 'Client does not support
authentication protocol requested by server; consider upgrading MySQL
client')

In order to be sure that MySQL was running and the db was reachable I
checked from IDLE and it worked (see code below), even if I got a warning
and had to instal pymysql (using: pip install pymysql). I was able to check
with MySQL Workbench (on Windows10) that a table was successfully created
in the db.

>>> from pydal import DAL, Field
>>> uri = 'mysql://root:web2py@localhost/test3'
>>> db = DAL(uri)
>>> ftable = db.define_table('files',
                    Field('fullname','string'),
                    Field('number','integer'),
                    Field('opendatetime','datetime'))

Warning (from warnings module):
  File "C:\Python27\lib\site-packages\pymysql\cursors.py", line 170
    result = self._query(query)
Warning: (3719, u"'utf8' is currently an alias for the character set
UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please
consider using UTF8MB4 in order to be unambiguous.")

>>> ftable
<Table files (id, fullname, number, opendatetime)>

Could someone help me understand what's going on or suggest some
documentation, please?
Thanks in advance, Jon.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to