How to import 'configuration' into a module

30 views
Skip to first unread message

Andrew Rogers

unread,
Dec 8, 2020, 8:34:30 AM12/8/20
to web2py-users
I want to use the auth functionality in a module.

I think I need to do this:
auth = Auth(db, host_names=configuration.get('host.names'))

Which means I need:
from gluon.tools import Auth

But how do I import the 'configuration' module?

I couldn't find any mention of it here:

Thanks
Andrew

Andrew Rogers

unread,
Dec 8, 2020, 8:38:46 AM12/8/20
to web2py-users
I found the answer 2 seconds after I posted the question which I did 20 minutes after looking through a lot of pages and code.

from gluon.contrib.appconfig import AppConfig 
from gluon.tools import Auth  

configuration = AppConfig() 
Reply all
Reply to author
Forward
0 new messages