3

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.

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

I was wondering the same as @amar - glad I found this thread. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.