Chapter 1: Introduction Introduction web2py[ web2py ] is a free, open-source web framework for agile development of secure database-driven web applications; it is written in Python[ python ] and programmable in Python. This means that it automatically addresses many of the issues that can lead to security vulnerabilities, by following well established practices. For example, it validates all input to prevent injections , escapes all output to prevent cross-site scripting , renames uploaded files to prevent directory traversal attacks. Experimentally we support more databases and new ones are constantly added. Please check on the web2py web site and mailing list for more recent adapters.
|Published (Last):||26 February 2006|
|PDF File Size:||14.20 Mb|
|ePub File Size:||16.49 Mb|
|Price:||Free* [*Free Regsitration Required]|
Reason: Ubuntu This guide is no longer maintained. See Instead: This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using.
You can use the search functionality at the top of the page to find a more recent version. Introduction The Python programming language is a versatile, high-level language that can be used easily for web programming, among other tasks. Building web applications can be difficult and toilsome on your own. Web frameworks preform much of the heavy lifting and can set up a template to build your web application easily.
Python has many different web frameworks. One of the most interesting is web2py. Web2py is a full-stack web framework that can be used to completely develop your web app. It has SQL database integration, a multi-threaded web server, and comes with a complete web IDE for designing your program. This allows you to easily program with a unified interface from anywhere you can access a web browser.
You can easily create and test your application in the same interface. We will be installing and working with this framework on an Ubuntu Install the Web2py Software Your Ubuntu server instance should already come with Python installed by default. This takes care of one of the only things that web2py needs to run successfully. Well, one of the great things about web2py is that you do not install it. You can run it right from this folder by typing: python web2py.
We will sort out the web access issue momentarily. We need to create our certificates before we can do that. Luckily, the openssl package is already installed. We can create an RSA key to use for certificate generation with the following command: openssl genrsa -out server. We can use these to start up the interface in a secure manner by passing some parameters to web2py when we call it: python web2py.
This is normal, since we signed the key itself. Click the button that allows you to proceed anyways. These are actually included sample applications. If you click on the folder titles, you will be taken to the live apps. It lists the standard MVC model, view, and controller files, as well as a languages directory, a static pages directory, and directories for modules, plugins, and private files.
This is actually just a graphical representation of what is going on in the filesystem. However, you must know how it interacts in order to effectively develop within this system. Coding-by-convention is a design choice selected in order to reduce the number of decisions a developer has to make. This means that a developer should only have to specify when they are moving away from a convention.
If we break this convention, we would have to specify the alternative. Otherwise, this is automatic. We can see that there is a controller called default. This is the default controller that is used when no other is specified.
This serves as a default. For our purposes, this does exactly what we want it to do. Next, we need to create the corresponding view to render the information that is being passed back the dictionary that defines message. We need to match the controller and function for this view to be automatically applied: Edit the file by clicking the button to the left of it. This is a useful method of keeping a consistent look between all of your pages.
If we visit the page in our browser, we can see how it renders. We can print this directly by editing our view. This allows us to dynamically generate content that is not necessarily available at the time the program is written. Conclusion You should now have a very basic understanding of the web2py framework.
More importantly, you should be able to see how easy it is to develop on this framework. The flexibility of being able to develop through text files or through a web interface means that you can work well in different environments.
The web interface also comes with a great number of tools for working with your growing application. You can see stack traces when a bug is introduced, you can easily package your application for deployment, and you view a log of all of the errors your application has encountered while developing. Web2py is a framework, an IDE, and a development suite all in one package. By Justin Ellingwood.
Web2py - Introduction
Next Page web2py is defined as a free, open-source web framework for agile development which involves database-driven web applications; it is written in Python and programmable in Python. It is a full-stack framework; it consists of all the necessary components, a developer needs to build a fully functional web application. Model is a part of the application that includes logic for the data. The objects in model are used for retrieving and storing the data from the database. View is a part of the application, which helps in rendering the display of data to end users. The display of data is fetched from Model.
Passo-a-Passo web2py, 1º Passo