Top 30 Web2py Framework Interview Questions for 2020

Facebooktwitterredditpinterestlinkedinmailby feather

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:

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.

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.

Controller: It helps to access the functions and modules. It acts as intimidator between Model and View.

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.

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 :

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.

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

In Web2py, Migration is used to disable all the table.

Example:

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

Yes, by using command line.

26) What is the process to send SMS?

The following code is used to send SMS:

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:

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

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

Facebooktwitterredditpinterestlinkedinmailby feather

Leave a Comment