Reputation: 4345
I am new to web2py but it has made me curious. Today i tried making a simple function in default.py
say testFunction()
on local host the url <localhost>TestApplication/default/testFunction
worked but after deployment to pythonanywhere it showed me error invalid view (default/testFunction.html)
I figured that its not getting a view for testFunction() so i made a default/testFunction.htm in views and then it worked.
My question is why cant web2py pick up the default view for my function if its not there,When deployed? How can i make it do it.
Upvotes: 3
Views: 294
Reputation: 435
It is by design:
If a view is not found, web2py tries to use a generic view. By default, generic views are disabled, although the 'welcome' app includes a line in /models/db.py to enable them on localhost only. They can be enabled per extension type and per action (using response.generic_patterns). In general, generic views are a development tool and typically should not be used in production. If you want some actions to use a generic view, list those actions in response.generic_patterns (discussed in more detail in the chapter on Services).
Upvotes: 3