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:

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

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *