문제

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.

도움이 되었습니까?

해결책

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top