I used the starter app example of mjbeller
I have the same app code on each app to instantiate the DAL but with
different appconfig.ini
appconfig.ini of app1
uri = sqlite://storage.sqlite
migrate = true
pool_size = 10 ; ignored for sqlite
appconfig.ini of app2
uri = sqlite://storage2.sqlite
migrate = false
pool_size = 10 ; ignored for sqlite
I used the same code to instantiate the DAL object on each app
## app configuration made easy. Look inside private/appconfig.ini
from gluon.contrib.appconfig import AppConfig
## once in production, remove reload=True to gain full speed
myconf = AppConfig(reload=True)
myconf_env = myconf.get('environment.type')
if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL(myconf.get(myconf_env + 'db.uri'),
pool_size = myconf.get(myconf_env + 'db.pool_size'),
migrate_enabled = myconf.get(myconf_env + 'db.migrate'),
check_reserved = ['mysql', 'postgres']) # ['all'])
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = DAL('google:datastore+ndb')
## store sessions and tickets there
session.connect(request, response, db=db)
Thanks
El martes, 17 de abril de 2018, 2:03:20 (UTC+2), Anthony escribió:
>
> They are not sharing the same db object just by virtue of it having the
> same name in the code. The code of each app is executed independently
> within requests for each app. Please show the code you are using to
> instantiate the DAL object in each app.
>
> Anthony
>
> On Monday, April 16, 2018 at 7:58:03 PM UTC-4, Sergio Romero wrote:
>>
>> Hi there.
>>
>> I have to deal with a duplicate example app on the same rocket server
>> instance. I have modified the sqlite file with each application interact
>> but both of the applicattions has the same db dal object name.
>>
>> When I start the server each applications shares the users and have some
>> problems with the foreign keys when I try to insert a row on a table of
>> app1 if the same table exists on app2
>>
>> How can I deal with this situation without refactor the db object name of
>> one of the application to isolate both applications and don't share the
>> instantiate db object between them.
>>
>> 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/d/optout.