Here is my Simple Example of Web Application Development using Web2py App.

  • How do you actually get started?!. In the Home/Welcome Page of your web2py, click on my sites


  • mysites

  • You will be then redirected to Admin's Login page.

    admin_login

  • Now, type your password i.e., the one which you intially have given while starting the server.

    admin_pwd

  • And now, you be redirected to the Webapplications Home page

    webapps_home

  • Now, in the create new application pane located to the left of the webapps home page

    create_app

  • You can now see, the application folder created

    app_folder

  • Now, click on the manage selection list available and choose edit option

    edit_app

  • You will be redirected to model-view-controller development/edit page

    mvc_home

  • Now, here you can create/edit the views,controllers and models

    create_view
    create_view

  • Go ahead and create a view intially. You can either use basic html elements or web2py specific signature statements

    favs_view
    view_code

  • Now, customize the layout of your application by including your css in the layout page

    favs_layout1

  • Also, include your javascript for form validations in the layout page

    favs_layout2

  • And, now include your layout page in the view

    include_layout

  • You would like to see it working now! Okay, try it here
Python Anywhere
  • In controller: simple_examples.py
    		    def hello1():
    		      return "Hello World"
    		  
    If the controller function returns a string, that is the body of the rendered page.
    Try it here: hello1
  • In controller: simple_examples.py
                        def hello2():
                          return T("Hello World")
                      
    The function T() marks strings that need to be translated. Translation dictionaries can be created at /admin/default/design
    Try it here: hello2
  • In controller: simple_examples.py
    		    def hello3():
    		      response.flash=T("Hello World in a flash!")
                          return dict(message=T("Hello World"))
                      
    response.flash allows you to flash a message to the user when the page is returned. Use session.flash instead of response.flash to display a message after redirection. With default layout, you can click on the flash to make it disappear.
    Try it here: hello3
  • In controller: simple_examples.py
    		     def hello4():
    		       response.view='simple_examples/hello3.html'
                           return dict(message=T("Hello World"))
    		   
    You can change the view, but the default is /[controller]/[function].html. If the default is not found web2py tries to render the page using the generic.html view.
    Try it here: hello4
  • You can always look into more and more examples here!!!