Edit: Updated, Jonathan point me that I'm wrong. Thanks.
The easy way to setup that our application is going to be default application in web2py, is to name the app as 'init'. With default application I mean when we put in our browser http://www.mysite.com/ or http://localhost/:8000, (controlled under web2py), the default application is going to be served.
There are another method introduced with the new router by Johnathan Lundell. (I take this from the web2py user group).
First we have to rename router.example.py to routes.py it's located in the web2py folder. Make a backup of the file if this already exist in your web2py folder.
1. | mv router.example.py routes.py |
Let's edit routes.py and look after this code:
1. | routers = dict( |
we are going to change default_application with our desire application name. Save the file and now if we introduce www.mysite.com in our browser we are getting our application instead of welcome application page. The same if we are testing in local machine, if we introduce http://localhost:8000
Note: After edit routes.py we have to re run web2py, if we want changes take effect.
This hide the application name from the url if we want the name in the url we need to do this
Instead of
http://localhost:8000/default/indexto have
http://localhost:8000/myapp/default/indexWe have to edit routes.py again and add application=None
1. | routers = dict( |
That's all!.