Web2py Intro
Web2py Intro
What is a Framework?
• A framework is a pre-designed set of rules, guidelines, and structures that
provide a common methodology for developing software applications,
websites, or systems.
• It provides a structure for developers to build upon and simplifies the
development process by offering pre-built components and functionality.
• Frameworks can include libraries, APIs, and tools that streamline the
development process and reduce the time and effort required to create a
software application or system.
• They are often used to facilitate the development of complex systems and
applications by providing a pre-defined architecture, which helps developers
to organize their code and maintain consistency across the application.
Web Frameworks
1.Django: A web framework for Python that follows the Model-View-Controller (MVC) architecture. It
provides a robust set of tools and libraries for building scalable web applications quickly.
2.Ruby on Rails: A web framework for Ruby that uses the Model-View-Controller (MVC) architecture.
It is designed to emphasize convention over configuration, making it easier for developers to get
started quickly.
3.Flask: A micro web framework for Python that is lightweight and flexible. It provides developers with
the basic tools needed to build web applications without imposing too much structure.
4.Express.js: A web framework for Node.js that is designed for building web applications and APIs. It
provides a simple and flexible approach to web development, making it popular for building real-time
applications.
5.ASP.NET: A web framework for Microsoft's .NET platform. It provides developers with a rich set of
tools and libraries for building scalable and secure web applications.
6.Laravel: A web framework for PHP that follows the Model-View-Controller (MVC) architecture. It
provides developers with a clean and elegant syntax for building web applications quickly and easily.
Web2Py
• Web2py is a free open-source web application framework that is
written in Python.
• It is designed to make web application development easy and fast.
• It provides an all-in-one solution for web application development,
including a web server, a database engine, and a web-based interface
for managing applications.
• Web2py follows the Model-View-Controller (MVC) architecture,
which helps developers to separate the application logic from the user
interface.
Web2py
• Web2py provides several built-in security features, such as automatic
form validation and protection against SQL injection attacks, cross-
site scripting (XSS) attacks, and other common web vulnerabilities.
• One of the unique features of Web2py is its ability to generate web-
based user interfaces for database models automatically.
Web2Py Architecture
Web2py follows the Model-View-Controller (MVC) architecture, which separates the
application logic into three interconnected components:
1.Model: The model component defines the data structure and the business logic of
the application. It interacts with the database to store and retrieve data, and it
provides an interface to the controller to access the data.
2.View: The view component defines the user interface of the application. It is
responsible for rendering the data provided by the controller into an HTML format
that can be displayed in a web browser.
3.Controller: The controller component acts as an intermediary between the model and
the view. It receives user requests from the web browser, processes them, and
decides how to respond to them. It interacts with the model to retrieve or update
data, and it passes the data to the view to render it into HTML.
Web2Py main components
1.Routing: The routing component maps URLs to controller functions, enabling
users to access specific pages or resources within the application.
2.Helpers: Web2py provides a set of helper functions and libraries that make it
easier to develop web applications. These helpers include functions for handling
forms, managing sessions, and handling user authentication.
3.DAL: The Database Abstraction Layer (DAL) provides a simple and intuitive
interface for interacting with the database. It allows developers to define database
tables, perform CRUD operations, and execute complex database queries.
4.Scheduler: The scheduler component provides a way to schedule tasks to run at
specific times or intervals. This can be used for performing background tasks,
such as sending emails or updating data.
Installing Web2py
• Web2py is based on Python, you will need Python 3.7 at least
installed on you machine.
• Install Web2py using url:
http://www.web2py.com/init/default/download
• Web2py comes with internal Web Server “Rocket” which is a
lightweight and fast. Alternatively, you can install Apache webserver.
• For database storage, you will need to install MySQL 5.0
https://dev.mysql.com/doc/refman/5.7/en/mysql-installer.html