One single MySQL database for many web2py applications

爷,独闯天下 提交于 2019-12-25 00:16:58

问题


I have 3 apps under my web2py framework. Can I use one single MySQL database for all of them (by prefixing tables) so users just need only one single registration to access those 3 apps? I fail on my attempts. Or any other solutions? Thanks so much.


回答1:


If multiple apps share the same database table, all but one of the apps must define that table with migrate=False to prevent migration attempts. Note, Auth.define_tables() also takes a migrate argument, so to turn off migrations specifically for the Auth tables, you can do:

auth.define_tables(migrate=False)

You can also turn off migrations for an entire database connection within an application with:

db = DAL(..., migrate_enabled=False)

See here for more about inter-app cooperation.



来源:https://stackoverflow.com/questions/8033307/one-single-mysql-database-for-many-web2py-applications

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!