×

Top 30 Web2py Framework Interview Questions for 2024

1) What is Web2py Framework?

Web2py is an open source web application framework. It is written in the Python programming language. It allows web developers to design and develop dynamic web application.

2) How can we Install Web2py in different operating system?

We can install Web2fy in different operating system by using following code:
Operation System Command
Unix and Linux python web2py.py
OS X open web2py.app
Windows web2py.exe

3) What are the protocols supports in Web2py?

Web2py supports various protocols like: XML, JSON, RSS, CSV, XMLRPC, JSONRPC, AMFRPC, and SOAP.

4) How to write a hello world program in Web2py?

We can write a hello world program by using following code:
def hello():  
        return 'Hello World'

5) Who is the author of Web2py?

Massimo Di Pierro developed the author of Web2py.

6) What is the stable version of Web2py?

Web2py stable version is 2.14.6 which is released on May 10, 2016.

7) How can we represent MVC (Model-View-Controller) in Web2py?

In Web2fy, we can represent MVC (Model-View-Controller) as follows- Model: It includes the logic of application data. It is used to database connections by configuring storage.sqlite files.
"db.py" is the model:  
db = DAL('sqlite://storage.sqlite')  
db.define_table(employee, Field('name'), Field('phone'))
View: View displays the output after the associated controller function is executed. It renders the variables in the dictionary, which is in the form of HTML. It uses {{ and }} delimiters to include the file.
{{extend 'layout.html'}}  
    <h1>Manage My Employees</h1>  
    {{=grid}
Controller: It helps to access the functions and modules. It acts as intimidator between Model and View.
def employees():  
grid = SQLFORM.grid(db.contact, user_signature = False)  
return locals(

8) What are the application components of web2py ?

Web2fy consists of the following components.
  • Models: It represents data and database tables.
  • Views: It helps rendering the display of the data.
  • Controllers: It describes the application logic and workflow.
  • Languages: describe how to translate strings in the application into various supported languages.
  • Static files: Do not require processing (e.g. images, CSS style sheets etc).
  • ABOUT and README: It provide details of the project.
  • Errors: It stores error reports generated by the application.
  • Sessions: It stores information related to each particular user.
  • Databases: It store SQLite databases and additional table information.
  • Cache: It store cached application items.
  • Modules: Modules are other optional Python modules.
  • Private: It includes files are accessed by the controllers but not directly by the developer.
  • Uploads: Files are accessed by the models but not directly by the developer.

9) What are the databases and their drivers support by Web2py?

Web2py supports following databases and their drivers.
Databases Drivers
SQLite sqlite3 or pysqlite2 or zxJDBC (on Jython)
PostgreSQL psycopg2 or pg8000 or zxJDBC (on Jython)
MySQL pymysql or MySQLdb
Oracle cx_Oracle
MSSQL pyodbc or pypyodbc
FireBird kinterbasdb or fdb or pyodbc
DB2 pyodbc
Informix informixdb
Ingres ingresdbi
Cubrid cubriddb

10) What are the crud Methods of Web2py?

Web2fy crud methods are :
Methods description
crud.tables() It returns a list of tables which is defined in the database.
crud.create(db.tablename) It returns a create form for the table tablename.
crud.read(db.tablename, id) It returns a read-only form for tablename and record id.
crud.delete(db.tablename, id) It is used to deletes the record
crud.select(db.tablename, query) It returns a list of records selected from the table
crud.search(db.tablename) Returns a tuple (form, records) where form is a search form

11) Which class is used to send email in Web2py Framework?

In Web2fy Framework, gluon.tools.Mail class is used to send email. The mailer can be defined with this class.
from gluon.tools import Mail  
    mail = Mail()  
    mail.settings.server = 'smtp.example.com:25'  
    mail.settings.sender = 'abc@example.com'  
    mail.settings.login = 'username:password'

12) What is the default port of Web2py?

Web2py default port is 8000.

13) What is Postbacks?

A better pattern in web2py is to submit forms to the same action, which generates them. This mechanism is called as "postback" which is the main feature of web2py. In short, self-submission is achieved in postback.

14) How can we create a model?

We can create a model by using following code :
db.define_table('company', Field('name', notnull = True, unique = True), format = '%(name)s')  
db.define_table(  
   'contact',  
   Field('name', notnull = True),  
   Field('company', 'reference company'),  
   Field('picture', 'upload'),  
   Field('email', requires = IS_EMAIL()),  
   Field('phone_number', requires = IS_MATCH('[\d\-\(\) ]+')),  
   Field('address'),  
   format = '%(name)s'  
)
db.define_table(  
   'log',  
   Field('body', 'text', notnull = True),  
   Field('posted_on', 'datetime'),  
   Field('contact', 'reference contact')  
)

15) Describe the workflow of Web2py?

Web2py workflow are given below :
  • The web server manages HTTP requests simultaneously in its own thread.
  • The HTTP request header is passed to the dispatcher.
  • The dispatcher manages the application requests and map the PATH_INFO in the URL of the function call. Every function call is represented in the URL.
  • All the requests for files included in the static folder are managed directly, and large file are streamed to the client.
  • Requests for anything but a static file are mapped into an action.
  • If the request header contains a session cookie for the app, the session object is retrieved; or else, a session id is created.
  • If the action returns a value as string, this is returned to the client.
  • If the action returns an iterable, it is used to loop and stream the data to the client.

16) What are the features of Web2py?

Web2py features are:
  • It is easy to learn.
  • It is portable.
  • It has standard library that supports many task.

17) What is the I/O functions in Web2py?

There are various I/O functions in Web2py that are given below.
  • open(): It helps to open a file or document
  • write(): It helps to write a string in file or document
  • read(): It helps to read the content in existing file
  • close(): This method closes the file object.

18) What is CRON in Web2py?

In Web2py, CRON gives the ability to run the task within the specified interval of the time.

19) What is RBAC in Web2py?

In Web2py, RBAC stands for Role Based Access Control. It is an approach to restricting system access to authorized used.

20) Which method is used to send an email in Web2py?

In Web2py, mail.send() method is used to send an email.

21) What are the protocols used in Web2py?

There are various protocols used in Web2py:
  • XML
  • JSON
  • RSS
  • CVC
  • SOAP etc.

22) Does Web2py support multiple database?

Yes, Web2py supports multiple database.

23) What is the use of DAL object?

DAL object is used to represents a database connection.
Example:  db = DAL('sqlite://storage.sqlite')

24) How can we disable all the table in Web2py?

In Web2py, Migration is used to disable all the table. Example:
db = DAL(..., migrate_enabled=False)

25) Is it possible to skip the GUI and start Web2py directory?

Yes, by using command line.
Example: python web2py.py -a 'your password' -i 127.0.0.1 -p 8000

26) What is the process to send SMS?

The following code is used to send SMS:
from gluon.contrib.sms_utils  
import SMSCODES, sms_email  
email = sms_email('1 (111) 111-1111','T-Mobile USA (abc)')  
mail.send(to = email, subject = 'test', message = 'test')

27) In which language Web2py was written?

Web2py was written in Python language.

28) What is Nginx?

Nigix is a free, open-source web server. It is used to configure file.

29) How can we delete the records?

We can delete the records by using following code:
crud.delete(db.tablename, id)

30) Which tag is used to escape python code embedded in HTML?

Web2py uses {{...}} tag to escape python code embedded in HTML.

Related Topics

Top 20 HTTP Interview Questions for 2024

1) What is HTTP? HTTP stands for Hypertext Transfer Protocol. It is a set of rules for transferring of data on WWW (World Wide Web). 2) What are the basic Features of...

4 minutes read.

Top 25 DB2 Interview question for 2024

1) Give breif detail about DB2? DB2 is a Relational Database Management System developed by IBM. It supports Object Oriented features and non-relational structures with XML. 2) Enlist the types of datatypes...

3 minutes read.

Top 15 iOS (iPhone, iPad) Interview Questions for 2024

Top 20 Most Frequently asked iOS Interview Questions and Answers 1) What is iOS? iOS is a mobile operating system developed by Apple Inc. iOS offers iPhone and iPad application development using...

3 minutes read.

Top 30 Cassandra Interview Questions for 2024

1) Explain. What is Cassandra? Cassandra is an open source data storage system. It was developed at Facebook for inbox search and designed for storing and managing large amount of data. 2)...

5 minutes read.

Top 10 WCF Interview Questions for 2024

  1. What is WCF? Windows Communication Foundation (WCF), earlier known by the name Indigo, is a run-time platform and a set of APIs in the .NET Framework for building, configuring, and...

7 minutes read.

Top 28 Prototype Interview Questions for 2024

1) What is Prototype? Prototype is a JavaScript framework which is used in dynamic web applications. It is a namespace and a module that is used to manage HTML forms. It is also...

4 minutes read.

Top 22 MariaDB Interview Question for 2024

1) What is MariaDB? It is a community based database devoloped by MySQL Devolopers. It provides same features as MySQL also, can be said that it is a replacement of MySQL. 2)...

3 minutes read.

Top 30 AngularJS Interview Questions and Answers for 2024

Most Frequently asked AngularJS Interview Questions and Answers for Fresher 1) Describe Angular JS ? It is a powerful framework of JavaScript. AngularJS is used to design Rich Internet Application. This framework...

5 minutes read.

Top 15 Hadoop Interview Questions for 2024

1) What is Hadoop? Hadoop is a framework which is used to store and process Big Data. It is a distributed computing platform and helps in analyzing Big Data. 2) What are the...

2 minutes read.

Top 15 Java OOPS Interview Questions for 2024

1) What are the advantages of Java Package? Advantages of Java package are: Provides access protection Removes naming collision Easily maintained 2) What are the types of Access Modifiers in Java? Two types...

4 minutes read.

Top 31 CakePHP Interview Questions for 2024

1) What is CakePHP? CakePHP is an open-source PHP framework. It is used to develop dynamic web applications. It helps to developers to work in a structured manner. 2) When cakePHP was...

5 minutes read.

Top 30 Sencha Touch Interview Questions for 2024

1) What is Sencha Touch? Sencha Touch is an UI (User Interface) JavaScript library. It is written in JavaScript. It is used to build mobile interface quickly and easily. It works...

6 minutes read.

Top 40 IoT Interview Questions and Answers in 2024

Q.1 What is IoT? IoT stands for the Internet of things refers to the interconnection of the network of various devices that can recognize, collect and transfer data over the internet...

13 minutes read.

Top 15 XML Interview Questions for 2024

1) What is XML? XML (eXtensible Markup Language) is designed to transport and store data. It has user executive tags i.e. no pre-defined tags used as in HTML. This language is...

2 minutes read.

Top 15 Meteor Interview Questions for 2024

1) What is Meteor or MeteorJS? Meteor is a JavaScript platform used for developing web and mobile applications. Applications develop using Meteor framework supports different platforms (like windows, android, ios). Meteor...

4 minutes read.

C++ | C Plus Plus Interview Questions for 2024

1) Write a program in C++ to print "Hello World"? #include <iostream.h>     #include <conio.h>   void main()    {       clrscr();       cout << "Hello World";     getch();     } 2) Write a program in C++ to enter two integers and find their sum and average ? #include <iostream.h>   #include <conio.h>   void main()   {   clrscr();   int x,y;   float sum,average;   cout << "Enter 2 integers : " << endl;   cin>>x>>y;   sum=x+y;   average=sum/2;   cout <<"The sum is:"<< sum << endl;   cout <<"The average is:"<< average << endl;   getch();   } 3) Write a program in...

5 minutes read.

Top 25 CoffeeScript Interview Questions for 2024

1) What is CoffeeScript? It is a language that compiles into JavaScript. CoffeeScript is an attempt to expose good parts of JavaScript so, that user can code more easily. 2) Name the...

3 minutes read.

Top 15 Framework7 Interview Questions for 2024

1) What is Framework7? Framework7 is an open source mobile HTML framework. It is used todevelop hybrid mobile apps for iOS and Android devices. 2) Why, framework7 is popular? There are various reasons...

8 minutes read.

Top 30 Ruby on Rails Interview Questions for 2024

1) What is Ruby on Rails? It is a server-side web application framework. It is an open source ruby framework which is used for developing database-backed web applications. Here, no compilation phase is...

4 minutes read.

Top 43 React Native Interview Questions for 2024

1. What is React Native? React native is an open-source JavaScript framework designed by Facebook for native mobile applications development. It is based on a JavaScript library-React. React Native saves your development...

11 minutes read.