Web2py – Make your app the default web application.

There are multiple ways of making your app the default web2py application, they are detailed here in the section called ‘Application Init’. When an app is the default web2py app, you don’t have to specify its name in its url when you visit it in your browser.


Here is a summary of the method that I prefer.


First create a file in your web2py directory called routes.py, you can rename routes.example.py to routes.py but if you do, remember to delete any example code that it may contain.


Add the following code to routes.py:
routers = dict(
BASE = dict(
Replace your_app_name_here with the name of your web application, and the restart web2py. How you restart web2py depends on how you run it, for example in my case I restarted apache.


When web2py has restarted you should now be able to access your app via a naked url.

2 replies

Comments are closed.