Does web2py support, out of the box, configuration per environment (development, staging, production, etc.)? Something similar to Grails and Ruby on Rails.
I read/skimmed through official book but could not find anything.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The web2py developers do not believe that is a good approach.
We do not believe in the sharp distinction between development and production.
For eaxmple, if an app has a bug, the bug is always recorded and logged, never shown to the user, only shown to the administrator.
Moreover web2py does not have a configuration file at all because apps should be portable without mangling with settings.
Yet you can manage different environments and in a more sophisticated way than Rails or Django allows. That is because models are not imported but executed at every request. You add your own conditions to detect the environment at runtime. For example:
You can see how to generalize this to more complex conditions. Of course you can make settings[‘development’]=True or False constant, which is the Rails equivalent way of doing it.