Full Stack web development with Python (Web2Py)
How to download and install web2py
1. Go to http://web2py.com/
2. Down load latest version http://web2py.com/init/default/downloadHow to download and install web2py
1. Go to http://web2py.com/
Unzip the downloaded file
CliCk on the Web2py.exe file to it will open the window like below
Provide the password(any password) and start the server
Server has been started. Now we need to create a application using web2py framework.
Click on the Admin, which is there on the right side in the page. And provide the password which we have given while starting the server
Create a new application using this framework- > New simple application –
Application Name - ex: sivaweb2py
Click on the create button. Now we have created application successfully.
Need to run the application
Now we need to write sample code in this application. So we need to understand basics of the
framework
framework
Need to edit the application
This framework will follow MVC architecture
Model- Contains db details
Controller – Method and logic details
Views – Html input/output to the user
Now we need to create one controller and respective views
Click on the Create button under Controller Section
I have given controller name as basics – basics.py will be created under controller
Now edit the controller – Click on the basics.py
def helloworld(): msg= "Hello welcome to basics controller!" return locals()
In the above code helloworld is method name . Copy the code and paste the same in your file.
Save the file and go to back – by click on the back buton
Now we need to create a view- under Views section
View name should be as method name ex: basics/helloworld
{{extend 'layout.html'}}
This is our first web page {{ =msg}}Writing first web2py is very easy