[No Audio]
Hey, welcome to a very informative lecture,
especially about those who are interested in
building web applications with Python.
As you may know, Python is used
for different purposes, from automating routine tasks
in your job, let's say you want to
generate PDF reports, automatically send automated emails, etc.
Then you can use Python for Data
Analysis and Visualization, Data Science and Machine
Learning, but also for Web Development.
So, building web applications with Python. And here is
where, I would like to stop and explain you
how exactly Python can be used in Web Development
and, what Python Web Frameworks you should use.
So I just mentioned the word, Web Framework.
So what is a Web Framework?
Well, with Python, you can build applications either
by using plain Python or by using one
of the Python Web Frameworks, which are basically
Python libraries that you install with pip.
And these web frameworks make it easier
to write web applications using Python.
Now, I can tell you that creating a
web app, without using one of these Web
Frameworks, is like reinventing the wheel.
Because if you don't use a Web Framework, you
basically have to rewrite, all the code that the
authors wrote, the authors of these Web Frameworks wrote.
So instead we just install these web frameworks and then
we use that code, that is inside the Web Frameworks.
And that code is usually things like, handling http
requests, and delivering web pages on the browser.
So routine low level tasks.
But instead of dealing with this task,
we want to focus on building the
functionality, the practicality of our web application.
So creating the input boxes, for example, for
our forms, sending users from one web page
to the other, so things like that.
So you should use a Web Framework.
So I guess we have clarified that point,
that you should use one Web Framework.
Now, the next question is which all
the Web Frameworks you should use?
Well, there are many Web Frameworks for Python,
but I'll only focus on three of them,
which is Flask, Django and JustPy.
[No Audio]
Let's start with Flask.
Flask is a Web Framework usually
targeted for building small web applications.
For example, let's say you just want to build a
small translator that translates, from one language to another.
Think of Google Translate.
If you just want that web application where people go
to your domain, let's say translator.com, and you just have
those two boxes there, people will type in the text
in one language in the first box and get the
results, so the translation in the other box.
So that would be a small app.
Another example would be an app where you
convert, let's say, JPG images to PNG images.
So people upload an image in JPG or vice versa.
So Flask handles all those uploading
and processing on the background. On the background,
of course, you'll probably need an
image processing library, besides Flask.
So you'll have to install, pip install
flask, and maybe pip install cv2.
So OpenCV to do the processing, but the serving to the
website, to the web app, will be done with Flask.
So Flask will get the original image and it will
get the output image from OpenCV, and it will serve
the output image for download on your web app.
So these are small web apps.
Now, don't get me wrong.
With Flask, you can also
create, bigger web applications.
And what I mean by bigger web applications, bigger
web apps, I mean things like, let's say you
have a blog website, where you add blogs every
week or every two days or so.
So you have maybe several authors who write
content for your blog,
[No Audio]
for that blog website.
So we're going to have different blogs, and all
these blogs have to be saved in a database.
Now, Flask can do this, of course,
but Django would do this better.
Django would do this better because, it is
easier to work with databases with Django, because
it has a better level of abstraction.
So with Flask, you can also do this
with Flask, but it's more work, you have
to do more routine tasks for Flask.
And Django would also allow you to
add more apps, in that website project.
So we took the example of blogs, you
will have blogs in your website, but maybe
you want to add another feature.
Let's say you want to add a translator there.
So Django can also build a translator,
on top of that existing website.
But if you just want to build a
translator alone, then Django would be an overkill.
What do I mean by that?
By that I mean that for smaller web apps,
Django takes more work to set it up.
To set up a Django project, it takes more work.
But once you set up a
Django project, then things go smooth.
But for smaller apps, it's good
to just create a Flask application.
It's very easy to create one.
So that is the difference between Django and Flask.
Now here comes JustPy.
JustPy is a very new Framework.
And why did I include JustPy
in this, set of three Web Frameworks?
Now, JustPy is quite special.
What do I mean by that?
Well, with Flask and Django, you also need to know
HTML and CSS, to be able to build web apps.
Because every web page that you see
on internet, it's built on HTML.
So all the text and input boxes and buttons, all
those are built in HTML code, which is very easy.
So don't get scared about HTML.
It's a very easy language to learn.
But I'm just saying that, you cannot create the
front end of a web page with Python.
So HTML is for the front end and then CSS is
to beautify, to prettify, the look of these HTML elements.
So the text boxes, the text, the colors, all
these can be made to look nicer with CSS.
So CSS is also a language which
is also very easy to learn.
So you'll have to write some CSS and HTML
code and save that code in HTML and CSS
files respectively, and put those files inside your web
app, be it in Django or Flask.
Now, here is where JustPy comes in.
JustPy allows you to create web apps
without writing any line of HTML and CSS.
JustPy is very new.
It's a new Framework, Web Framework.
And as I said, the good thing about JustPy
is that you don't have to write HTML and
CSS because, JustPy has some specific Python objects.
Let's say it has a div to create these divisions,
where you can put text and things like that.
Or it has a button object.
So Python button object to create
a button on the web page.
Of course, the downside of this is that, you are
not very flexible, as you'd be with Flask and Django.
Again, I would say JustPy
is also for small web applications.
If you want to build a blog website with
lots of content, JustPy is not the best choice.
It doesn't work very well with databases
as much as Django does or Flask.
But again, if you just want to build a
small web app and you don't know CSS or
HTML, then JustPy could be better than Flask.
So that was an overview of
three Web Frameworks for Python.
Now, all these three Web Frameworks are
covered in the course, in this course.
So we will build at least one web
app, with each of these three Web Frameworks.
And it may be tempting that you want to
watch only the videos, of the Web Framework that
you like, but I would recommend that you don't
skip any of these Web Frameworks.
I'm saying that because if you want to do
Web Development with Python, then it's a good idea
to be exposed to different Web Frameworks.
Each of the Frameworks does things differently.
So you will learn a good deal of, Web Development.
For example, Flask does things a bit more
low level and row, and that helps you
understand Web Development from a deeper perspective.
But then you'll learn about Django and you'll appreciate
the high level of abstraction that Django has.
You'll appreciate how easy it is to make
changes in your web apps, when you use
Django because of that high level usability.
So Django hides some things from you
which makes things easier, but you will
not understand some of those things.
So that's why you should also learn Flask.
And also JustPy is very fun to learn.
And I would recommend JustPy, especially for someone who
is not interested to become a core Web Developer.
So maybe you are a Data Analyst, but you
just want to make a web app where you
show some data, some visualization on that web app.
In that case, JustPy could
be actually the best choice.
But if you want to be a pure web developer,
then you want to learn Django and Flask.
And then when you have to build a web
app, you can just pick one of the Web
Frameworks which is best for that project,
or maybe the web framework that you know better, why not?
I hope this helps and I'll talk to you later.