You are on page 1of 16

1

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

Web development using Python Flask


(Instructional Module)

A Student Faculty Collaborative Project Study Presented to the

Faculty of Electronics and Communications Engineering

College of Engineering & Industrial Technology

Rizal Technological University

Boni Avenue, Mandaluyong City, Metro Manila

In Partial Fulfilment of the Requirements for the Degree of

Bachelor of Science in Electronics and Communications Engineering

Allorde, Richmund G.

Caintoy, Chrissie Jane T.

Mallo, Harland T.

Ortiz, John Maverick N.

Faculty Collaborator

Dr. Wilfredo L. Timajo


2

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

Approval Sheet
In partial fulfillment for the Degree of Bachelor of Science in Electronics and Communications
Engineering, this thesis titled, “Web development using Python Flask” has been prepared and
submitted by: Richmund G. Allorde, Chrissie Jane T. Caintoy, Harland T. Mallo and John
Maverick N. Ortiz, who are hereby recommended for oral examination.

Dr. Wilfredo L. Timajo Engr. RS L. Lagrimas


Instructor Thesis Adviser

Approved by the Panel of Oral Examiners with a grade of _______.

Engr. Julius F.
Engr. Jaime P. Licuanan
Mabanglo
Member Member

Engr. Ricardo N. Nasuli


Chairman

February 2020
Approved and accepted in partial fulfillment of the requirements of the subject, Project Study 2.

Engr. Roy I. Gomez Engr. Orlando M. Echaluse


Department Head, ECE Dean, CEIT
3

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

DEDICATION
This design is dedicated to the following:

To our God, Almighty Father, for without His graces and blessings, this study
would not have been possible.

To our Parents, for their endless love, sacrifices, and supports all throughout
the hurdles and difficulties in the process.

To all our friends and classmates who shared their words of advice,
motivation and knowledge.

To the future students, may be a good reference to the study you will make.

ACKNOWLEDGEMENT
4

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

This study will not be accomplished without the support of others. The proponents would like
to express their sincere gratitude and appreciation to the people who helped towards the
completion of this study.
Firstly, to our Almighty God, for the wisdom he bestowed upon us, the strength,
patience and good health in order to finish this design.
To our parents and guardians, for their endless love, encouragement and love to pursue
this study.
To the members of panels, who make their presence despite of their schedule and
support us by their comments and evaluations that help us to improve our work.
To our friends and for those people, who share their knowledge and experienced about
the study.

Abstract
Title: Web development using Python Flask
5

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

Designer Allorde, Richmund G., Caintoy, Chrissie Jane T., Mallo, Harland T., Ortiz, John
: Maverick N.

School: Rizal Technological University

Degree: Bachelor of Science in Electronics Engineering

ABSTRACT
Develop Website using Python and Flask.

Results
Success

TABLE OF CONTENTS
Web development using Python Flask______________________________________________1
Approval Sheet_________________________________________________________________2
DEDICATION___________________________________________________________________3
ACKNOWLEDGEMENT___________________________________________________________4
Abstract______________________________________________________________________5
Abstract___________________________________________________________________________5
Results__________________________________________________________________________________5

Chapter I______________________________________________________________________7
Introduction________________________________________________________________________8
Web Development_________________________________________________________________________8
Web Application___________________________________________________________________________8
Framework_______________________________________________________________________________8
Python__________________________________________________________________________________8
Flask____________________________________________________________________________________8
Pros of Flask______________________________________________________________________________9
Cons of Flask______________________________________________________________________________9
Who this research is for?____________________________________________________________________9
Research Paradigm________________________________________________________________________10
6

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

Statement of the Problem__________________________________________________________________10


Null Hypothesis________________________________________________________________________10
Alternate Hypothesis____________________________________________________________________10
Significance of the Study___________________________________________________________________10
Definition of Terms________________________________________________________________________10

Chapter II____________________________________________________________________10
Synthesis of the Study_______________________________________________________________10
Chapter III____________________________________________________________________10
Research Method Used______________________________________________________________11
Tools_____________________________________________________________________________11
Data Gathering_____________________________________________________________________11
Statistical Treatment of Data________________________________________________________________11

Chapter IV___________________________________________________________________11
Implications on the Study____________________________________________________________11
Chapter V____________________________________________________________________11
Summary of Findings________________________________________________________________11
Conclusions_______________________________________________________________________11
Recommendations__________________________________________________________________11
Bibliography__________________________________________________________________12
Experiment Modules___________________________________________________________14
Module 1_________________________________________________________________________14
Objectives_______________________________________________________________________________15
Discussion_______________________________________________________________________________15
Experiment______________________________________________________________________________15
Module 2_________________________________________________________________________16
Introduction to Flask______________________________________________________________________16
Objectives_______________________________________________________________________________16
Discussion_______________________________________________________________________________16
Experiment______________________________________________________________________________16
Module 3_________________________________________________________________________16
Introduction to Flask______________________________________________________________________16
Objectives_______________________________________________________________________________16
Discussion_______________________________________________________________________________16
Experiment______________________________________________________________________________16
7

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

Module 4_________________________________________________________________________17
Introduction to Flask______________________________________________________________________17
Objectives_______________________________________________________________________________17
Discussion_______________________________________________________________________________17
Experiment______________________________________________________________________________17
Module 5_________________________________________________________________________17
Introduction to Flask______________________________________________________________________17
Objectives_______________________________________________________________________________17
Discussion_______________________________________________________________________________17
Experiment______________________________________________________________________________17
Module 6_________________________________________________________________________17
Introduction to Flask______________________________________________________________________17
Objectives_______________________________________________________________________________17
Discussion_______________________________________________________________________________17
Experiment______________________________________________________________________________17

Chapter I
The Problem and its Setting
8

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

INTRODUCTION
One can hardly develop new applications in our "now world" without duct-taping a lot of
technologies together, be it new trend databases, messaging systems, or languages of all kinds.
When talking about web development, things might get slightly more complicated as not only
do you have to mix a lot of technologies together, but they must also work well with the
applications accessing them (also known as web browsers). They should also be compatible
with your deployment server, which is another story.

Web Development
Web Application
Framework
Python
Flask
The Flask framework is actually a glue, a very nice one, that sticks together the amazing
Werkzeug and Jinja2 frameworks, responsible for answering requests and presenting the
output (HTML, maybe). In the MVC architecture, also known as Model-View-Controller, Flask
covers C and V. But where is M? Flask does not provide you with an integrated model layer out-
of-the-box as that is not actually needed for a web application. If you do need to work with a
database, just pick your database solution from the many available and create your own model
layer, which is not hard, and be happy! The concept of a micro-framework, with good intentions
and made just for Flask, is all about giving you the the smallest (but also the most useful)
feature set you need, and one that won't get in the way.
Just what are the features that must be in the framework?
 A development server and debugger (sanity-friendly)
 Unicode support (Latin language-friendly)
 WSGI compliance (uWsgi-friendly)
 A unit-test client client (code with quality)
 URL routing (it brings tears to my eyes, it's so beautiful!)
 Request dispatching
 Secure cookies
 Sessions
 Jinja2 templates
9

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

With that much, you can handle Ajax requests, browser requests, and user sessions between
requests; route HTTP requests to your controllers; evaluate form data; respond to HTML and
JSON; and so on.
Flask is not an MVC framework as it does not implement the model layer, although it does not
restrict you in any way if you wish to create your own.
If you need a simple, single-file web application that receives a form and gives back an answer,
HTML or not, Flask will help you with that, easily. If you need a multilayer, high-depth
modularized Facebook clone, Flask can also be there for you.
One of the design decisions in Flask was that simple tasks should be simple; they should not
take a lot of code and yet they should not limit you. Because of that, Flask has a few design
choices that some people might find surprising or unorthodox. For example, Flask uses thread-
local objects internally so that you don’t have to pass objects around from function to function
within a request in order to stay threadsafe. This approach is convenient but requires a valid
request context for dependency injection or when attempting to reuse code which uses a value
pegged to the request. The Flask project is honest about thread-locals, does not hide them, and
calls out in the code and documentation where they are used.
Flask positions itself, not as a full-power out-of-the-box solution like both Django and Web2py,
but as a minimalistic solution where you're given the bare minimum to work with and choose
all the other stuff. That's very helpful when you want granular control of your application, when
you want to precisely pick your components, or when your solution is simple (not simplistic,
okay?).

Pros of Flask
Cons of Flask
Who this research is for?
This book targets Python developers, with some or no experience with web development, who
wish to create minimalistic web applications. It is focused on those who want to become web
developers as all the basics are covered to some extent, and also on those who already are
familiar with web development using other frameworks, be it Python-based frameworks such
as Django, Bottle, or Pyramid, or frameworks from other languages.
It is also important that you have a basic understanding of web technologies used to construct
web pages, as is the case for CSS, JavaScript, and HTML. If that is not your background, please
check out the W3Schools website (http://w3schools.com/) as it covers the basics of using these
technologies. Also, if you're skilled with the Linux terminal, your life will be much easier
10

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

throughout the whole book; try the link


https://help.ubuntu.com/community/UsingTheTerminal if this is not the case.
Nonetheless, be assured that, if you have a basic knowledge of Python, you're more than
capable of understanding the examples and the chapters; at the end of the book, you will be
creating amazing web applications that perform well and are easy to maintain
Significance of this research?

Research Paradigm
1. Develop an instructional course for web development using Flask.

Statement of the Problem


To develop a website using phyton.
Null Hypothesis
Using Flask as a framework does not make web development easier.
Alternate Hypothesis
Using flask as a framework does make web development easier.

Significance of the Study


Providing value to

Definition of Terms
Python, Website, Flask,

Chapter II
Review of Related Literature

Website
Python
Flask

SYNTHESIS OF THE STUDY

Chapter III
Research Methodology
11

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

RESEARCH METHOD USED

TOOLS
Python

DATA GATHERING
Statistical Treatment of Data
Chapter IV
Presentation, Analysis, and Interpretation of Data

IMPLICATIONS ON THE STUDY

Chapter V
Summary, Conclusions, and Recommendations

SUMMARY OF FINDINGS

CONCLUSIONS

RECOMMENDATIONS

Bibliography
(n.d.). Retrieved from https://flask.palletsprojects.com/
12

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

Aslam, F. A., Mohammed, H. N., & Lokhande, P. P. (2015). Efficient way of web development
using python and flask. International Journal of Advanced Research in Computer Science,
6(2). doi:DOI: https://doi.org/10.26483/ijarcs.v6i2.2434
Boehm, B. W. (1981). Software Engineering Economics. IEEE Transactions on Software
Engineering, SE-10(1), 4-21. doi:10.1109/TSE.1984.5010193
Chang, C. C., Körber, C., & Walker-Loud, A. (2020, February 21). EspressoDB: A scientific
database for managing high-performance computing workflow. (G. K. Thiruvathukal,
Ed.) Journal of Open Source Software, 5(46), 2007. doi:10.21105/joss.02007
Chauhan, N., Singh, M., Verma, A., Parasher, A., & Budhiraja, G. (2019, December 20).
Implementation of database using python flask framework: college database
management system. International Journal of Engineering and Computer Science, 8(12),
24894-24899. doi:https://doi.org/10.18535/ijecs/v8i12.4390
Garett, R., Chiu, J., Zhang, L., & & Young, S. D. (2016). A Literature Review: Website Design and
User Engagement. Online journal of communication and media technologies, 6(3), 1–14.
Retrieved from
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4974011/pdf/nihms732828.pdf
Kampik, T., & Nieves, J. C. (n.d.). JS-son—A Lean, Extensible JavaScript Agent Programming
Library. European Microbeam Analysis Society 2019. Retrieved from arXiv:2003.04690
Kulkarni, P., Kailash, Shankar, V., & Nagarajan, S. (2009). Programming Languages: A
Comparative Study. Retrieved from
https://pdfs.semanticscholar.org/164a/22ecec26532513127bfc9734f5fb65ae03af.pdf?
_ga=2.134347121.1071434247.1592695128-2073770326.1592695128
Nanz, S., & Furia, C. A. (2015). A Comparative Study of Programming Languages in Rosetta Code.
2015 IEEE/ACM 37th IEEE International Conference on Software Engineering. 1, pp. 778-
788. IEEE. doi:10.1109/ICSE.2015.90
Nowotka, M., Papadatos, G., Davies, M., Dedman, N., & Hersey, A. (2015). Want Drugs? Use
Python. 8th European Conference on Python in Science. Retrieved from
arXiv:1607.00378
Pereira-Sarmiento, J., & Enciso, L. (2019). Virtual Tutoring System with Interactive Feedback
between Teacher-Student. 2019 14th Iberian Conference on Information Systems and
Technologies (CISTI) (pp. 1-6). Coimbra, Portugal, Portugal: IEEE.
doi:10.23919/CISTI.2019.8760823
13

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

Power, R., & Rubinsteyn, A. (2013). How fast can we make interpreted Python? New York
University, New York. Retrieved from arXiv:1306.6047
Prechelt, L. (2000). An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl for a
search/string-processing program. Retrieved from
https://pdfs.semanticscholar.org/eaea/dc746ec5673db952d2a600555f0e5089659c.pdf?
_ga=2.58768045.1071434247.1592695128-2073770326.1592695128
Prechelt, L. (2000). An Empirical Comparison of Seven Programming Languages. IEEE Computer,
33, 23-29. doi:10.1109/2.876288
Prechelt, L. (2006). Plat_Forms—a contest: The web development platform comparison.
Technical Report, Freie Universität Berlin Institut für Informatik. Retrieved from
arXiv:0805.0650
Pritchard, D., & Vasiga, T. (2013). CS Circles: An In-Browser Python Course for Beginners. SIGCSE
2013 - 44th Conference. Denver, Colorado. Retrieved from arXiv:1209.2166
Pugachev, K., Dimova, T., Kardapoltsev, L., Korol, A., Kovrizhin, D., & Shtol, D. (n.d.). DQM Tools
and Techniques of the SND Detector. The International Conference “Instrumentation for
Colliding Beam Physics” (INSTR20). JINST. Retrieved from arXiv:2005.14143
Rohit Muthyala, Wood, S., Jin, Y., Qin, Y., & Hua Gao, A. R. (n.d.). Data-driven Job Search Engine
Using Skills and Company Attribute Filters. Retrieved from arXiv:1709.05050
Ruohonen, J. (2019). An Empirical Analysis of Vulnerabilities in Python Packages for Web
Applications. 9th International Workshop on Empirical Software Engineering in Practice
(IWESEP 2018). Nara: IEEE. doi:10.1109/IWESEP.2018.00013
Svyatkovskiy, A., Deng, S. K., Fu, S., & Sundaresan, N. (2020, May 16). IntelliCode Compose:
Code Generation Using Transformer. Retrieved from arXiv:2005.08025
Tahmooresi, H., Heydarnoori, A., & Aghamohammadi, A. (2020, April 14). An Analysis of
Python's Topics, Trends, and Technologies Through Mining Stack Overflow Discussions.
Retrieved from arXiv:2004.06280
Thomas, M., Steenberg, C., Lingen, F. v., Newman, H., Bunn, J., Ali, A., . . . In, J. U. (2005).
JClarens: A Java Framework for Developing and Deploying Web Services for Grid
Computing. 3rd IEEE International Conference on Web Services (ICWS05). Florida, USA:
IEEE. Retrieved from arXiv:cs/0504044
14

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

Vogel, P., Klooster, T., Andrikopoulos, V., & Lungu, M. (2017). A Low-Effort Analytics Platform
for Visualizing Evolving Flask-Based Python Web Services. IEEE Working Conference on
Software Visualization (VISSOFT), 109-113. doi:doi: 10.1109/VISSOFT.2017.13.
Zhai, H., Casalnuovo, C., & Devanbu, P. (2019). Test Coverage in Python Programs. 2019
IEEE/ACM 16th International Conference on Mining Software Repositories (MSR) (pp. 116-120).
Montreal, QC, Canada: IEEE. doi:doi: 10.1109/MSR.2019.00027

Experiment Modules
MODULE 1
Introduction to Flask

All throughout the experiment modules, we’ll be using Windows as our operating system and
Google Chrome as our main browser. You may also use your browser of choice for all the
experiments.

Objectives
Show “Hello World!” in your browser.

Discussion
Flask is

Experiment
# coding:utf-8
from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
15

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

return "Hello World!"

if __name__ == "__main__":
app.run()

MODULE 2
Introduction to Flask
Objectives
Discussion
Experiment

MODULE 3
Introduction to Flask
Objectives
Discussion
Experiment
16

RIZAL TECHNOLOGICAL UNIVERSITY


College of Engineering, Architecture and Technology
Boni Avenue, Mandaluyong City

MODULE 4
Introduction to Flask
Objectives
Discussion
Experiment

MODULE 5
Introduction to Flask
Objectives
Discussion
Experiment

MODULE 6
Introduction to Flask
Objectives
Discussion
Experiment

You might also like