myconf.take, myconf.get
This commit is contained in:
@@ -14,10 +14,12 @@ from gluon.contrib.appconfig import AppConfig
|
||||
## once in production, remove reload=True to gain full speed
|
||||
myconf = AppConfig(reload=True)
|
||||
|
||||
|
||||
if not request.env.web2py_runtime_gae:
|
||||
## if NOT running on Google App Engine use SQLite or other DB
|
||||
db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all'])
|
||||
db = DAL(myconf.get('db.uri'),
|
||||
pool_size = myconf.get('db.pool_size'),
|
||||
migrate_enabled = myconf.get('db.migrate'),
|
||||
check_reserved = ['all'])
|
||||
else:
|
||||
## connect to Google BigTable (optional 'google:datastore://namespace')
|
||||
db = DAL('google:datastore+ndb')
|
||||
@@ -32,8 +34,8 @@ else:
|
||||
## none otherwise. a pattern can be 'controller/function.extension'
|
||||
response.generic_patterns = ['*'] if request.is_local else []
|
||||
## choose a style for forms
|
||||
response.formstyle = myconf.take('forms.formstyle') # or 'bootstrap3_stacked' or 'bootstrap2' or other
|
||||
response.form_label_separator = myconf.take('forms.separator')
|
||||
response.formstyle = myconf.get('forms.formstyle') # or 'bootstrap3_stacked' or 'bootstrap2' or other
|
||||
response.form_label_separator = myconf.get('forms.separator')
|
||||
|
||||
|
||||
## (optional) optimize handling of static files
|
||||
@@ -53,7 +55,7 @@ response.form_label_separator = myconf.take('forms.separator')
|
||||
|
||||
from gluon.tools import Auth, Service, PluginManager
|
||||
|
||||
auth = Auth(db)
|
||||
auth = Auth(db, host=myconf.get('host.name'))
|
||||
service = Service()
|
||||
plugins = PluginManager()
|
||||
|
||||
@@ -62,9 +64,11 @@ auth.define_tables(username=False, signature=False)
|
||||
|
||||
## configure email
|
||||
mail = auth.settings.mailer
|
||||
mail.settings.server = 'logging' if request.is_local else myconf.take('smtp.server')
|
||||
mail.settings.sender = myconf.take('smtp.sender')
|
||||
mail.settings.login = myconf.take('smtp.login')
|
||||
mail.settings.server = 'logging' if request.is_local else myconf.get('smtp.server')
|
||||
mail.settings.sender = myconf.get('smtp.sender')
|
||||
mail.settings.login = myconf.get('smtp.login')
|
||||
mail.settings.tls = myconf.get('smtp.tls')
|
||||
mail.settings.ssl = myconf.get('smtp.ssl')
|
||||
|
||||
## configure auth policy
|
||||
auth.settings.registration_requires_verification = False
|
||||
|
||||
Reference in New Issue
Block a user