created in the spirit of Ruby on Rails.
Environments that match your development stages.
Wheels allows you to set up different environments that match stages in your development cycle. That way you can configure different values that match what services to call and how your app behaves based on where you are in your development.
By default, all new applications will start in the Design environment. The Design environment is the most convenient one to use as you start building your application because it does not cache any data. Therefore, if you make any changes to your database, for example, it will immediately be picked up by Wheels.
Other environment modes caches this information in order to speed up your application as much as possible. Making changes to the database in these environment modes will cause Wheels to throw an error. (Although that can be avoided with a reload call. More on that later.)
The fastest environment mode in terms of page load time is the Production mode. This is what you should set your application to run in before you launch your website.
Besides the 2 environments mentioned above, there are 3 more. Let's go through them all one by one so you can see the differences between them and choose the most appropriate one given your current stage of development.
init() methods).application.settings.ipExceptions variable in config/settings.cfm or passed along in the URL as except=127.0.0.1,127.0.0.1).This environment mode comes in handy when you want to briefly take your website offline to upload changes or modify databases on production servers.
You change the current environment by modifying the config/environment.cfm file. After you've modified it, you need to either restart the ColdFusion service or issue a reload request. (See below for more info.)
reload RequestIssuing a reload request is the easiest way to go from one environment to another. It's done by passing in reload as a parameter in the URL, like this:
http://www.mysite.com/?reload=true
This tells Wheels to reload the entire framework (it will also run your code in the events/onapplicationstart.cfm file), thus picking up any changes made in the config/environment.cfm file.
There's also a shortcut for lazy developers who don't want to change this file at all. To use it, just issue the reload request like this instead:
http://www.mysite.com/?reload=testing
This will make Wheels skip your config/environment.cfm file and just use the URL value instead (testing, in this case).
For added protection, you can set the reloadPassword variable in config/settings.cfm. When set, a reload request will only be honored when the correct password is also supplied, like this:
http://www.mysite.com/?reload=testing&password=mypass
Comments
Read and submit questions, clarifications, and corrections about this chapter.
There are no comments for this chapter. Be the first to comment!