Thanks. I really need to modify this programmatically for a functional test 
suite - it's not so much a dev vs prod thing. If I have a modified 
appconfig, how do I set web2py to use it for a particular rocket instance, 
but not normally?

On Thursday, 1 March 2018 11:33:15 UTC, 黄祥 wrote:
>
> i think you can do it programmitacally, using the variable or create 
> multiple appconfig.ini e.g. (dev_appconfig.ini), for the first suggestion, 
> usually do this 
> *models/db.py*
> from gluon.contrib.appconfig import AppConfig
> config_path = os.path.join(request.folder, 'private')
> configuration = AppConfig('%s/appconfig.ini' % config_path, reload = True)
> configuration_env = configuration.get('environment.type')
> # this the example, to get the value of dev_smtp.sender
> mail.settings.sender = configuration.get(configuration_env + '_' + 
> 'smtp.sender')
>
> *private/appconfig.ini*
> [environment]
> type = dev
> ;type = test
> ;type = stage
> ;type = prod
> [dev_smtp]
> sender = We Care <ano...@test.com <javascript:>>
> [test_smtp]
> sender = We Care <ano...@test.com <javascript:>>
> [stage_smtp]
> sender = We Care <ano...@test.com <javascript:>>
> [prod_smtp]
> sender = We Care <ano...@test.com <javascript:>>
>
> for the later suggestion, just adapt it on the file name instead 
> (dev_appconfig.ini)
>
> best regards,
> stifan
>

-- 
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