Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions Network Architect Interview Questions

Top 30 Web2py Framework Interview Questions for 2022

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 = '[email protected]'  
    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.