Learn-Write-Repeat / Open-contributions

This Repository is for Learning purpose, and open contributions under DevIncept program.
https://dcp.devincept.com/
MIT License
47 stars 445 forks source link

Understanding Flask #175

Open arpit-dwivedi opened 3 years ago

Rishav-hub commented 3 years ago

Flask is a Python framework that is used to build basic webpages. To make a successful webpage one should have knowledge of basic HTML and CSS. So I tried to make a basic webpage that works on my localhost.

The installation of a Flask should be carried in a virtual environment.

akrish4 commented 3 years ago

Understanding_Flask

aditya9110 commented 3 years ago

I have made a simple app that shows a html page displaying my name

anillko1108 commented 3 years ago

Flask

What is Flask?

Flask is an API of Python that allows us to build up web-applications. It was developed by Armin Ronacher. Flask’s framework is more explicit than Django’s framework and is also easier to learn because it has less base code to implement a simple web-Application. A Web-Application Framework or Web Framework is the collection of modules and libraries that helps the developer to write applications without writing the low-level codes such as protocols, thread management, etc. Flask is based on WSGI(Web Server Gateway Interface) toolkit and Jinja2 template engine.

john-2424 commented 3 years ago

Today I learnt about a web framework called "Flask". It is a micro web framework which can add application features or develop and support web applications. It is based upon Pocco projects such as Werkzeug and Jinja2.

Werkzeug is a toolkit for WSGI applications. Werkzeug can realize software objects for request, response, and utility functions.

Jinja2 is a template engine which combines templates with a data model to produce result documents.

After referring to documentation of Flask and few examples, I was able to create a web application to display "Hello World!!".

Commands to run Flask

Output _ Hello World

JulianBenny commented 3 years ago

Flask is a web application framework written in Python. Armin Ronacher, who leads an international group of Python enthusiasts named Pocco, develops it. Flask is based on Werkzeug WSGI toolkit and Jinja template engine. Both are Pocco projects.

I tried making a basic web app using flask which prints hello world! in the browser and below are the steps(for Ubuntu users) I took:

  1. Created python virtual environment,(in the particular directory of your choice) python3 -m venv venv (name of virt env)
  2. Installed flask in it. pip install flask
  3. Create a python file in the same directory with this code
  4. Then finally run the following commands: export FLASK_APP=<name of your python file> flask run
  5. Now you'll see a link, open that in your browser. Screenshot from 2020-10-06 17-25-21
aditya9110 commented 3 years ago

Hello Sir, here's what I tried creating using Flask: To Do List App

jaydhamale7 commented 3 years ago

What is Flask? Flask is an API of Python that allows us to build up web-applications.. Flask’s framework is more explicit than Django’s framework and is also easier to learn because it has less base code to implement a simple web-Application. A Web-Application Framework or Web Framework is the collection of modules and libraries that helps the developer to write applications without writing the low-level codes such as protocols, thread management, etc. Flask is based on WSGI(Web Server Gateway Interface) toolkit and Jinja2 template engine. Flask is easy to learn and very easy to deploy ml apps with flask.

aditya9110 commented 3 years ago

ML Model Deployment using Flask

But if you want to host like a website, you require some hosting, isn't it?

ashReal commented 3 years ago

What is Flask?

What is WSGI?

What is Jinja2?

Note: To install flask on the system, we need to have python 2.7 or higher installed on our system.

akrish4 commented 3 years ago

Deploy ML model using Flask

To host the web app , Heroku is one of the free hosting platform , heroku is a container-based cloud Platform as a Service (PaaS).

anillko1108 commented 3 years ago

Deploy Machine Learning Model Using Flask

kanchitank commented 3 years ago

Understanding Flask and building a simple application.

What is Flask?


A simple application

The output would be the following:

Link to the detailed explanation of flask, code, and application.

kanchitank commented 3 years ago

ML Model Deployment Using Flask

What is Model Deployment?

What do you need to deploy an application?

In order to deploy any trained model, you need the following:

Heroku

sagarrajroul commented 3 years ago

what is flask?

Flask is a web framework that provides libraries to build lightweight web applications in python.

What is WSGI?

Web Server Gateway Interface is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. It acts as an interface between web servers and web applications.

What is jinja2?

Jinja2 is a template engine written in pure Python. It combines a template with a certain data source to render dynamic web pages.

Works to do?

  1. Install python latest version on your computer.
  2. Create a new folder on desktop and a new environment on that folder.
  3. After all these things install flask on the environment using code 'pip install flask'.
  4. Now open a text editor or python ide and create a file with .py extension.
  5. Now write python code: "from flask Import Flask app = Flask(name) @app.route('/') def index(): return '< h1>Hello World< /h1>'
  6. Now open the link 🔗 http://127.0.0.1:500/

OUTPUT

Hello World

uc-creat commented 3 years ago

Day1- Things I learned

Biswajit-Panda commented 3 years ago

🕸️ Flask:

Flask is a web application framework. It is a collection of modules and packages which help the user to create a dynamic web application. It helps in the creation, development, and deployment of web applications. Flask is based on WSGI and Jinja2.

WSGI: (Web Server Gateway Interface) is an interface between web servers and web applications. Jinja2: Jinja2 combines a template with a certain data source to render dynamic web pages.

Today, I install the flask module using 'pip install flask' inside the virtual environment (venv) in python.

I learned to create the 'hello world' of the flask. 👉 First I import flask 👉 create the App object 👉 route the '/' to index() function 👉 define the index() function and return the HTML code to display 'Hello world!' 👉 set the FLASK_APP to the .py file and run the flask to display the HTML content in the browser.

Then, I write some HTML code inside the given code and display it on my browser.(link) 😃 📚

shalakasaraogi commented 3 years ago

Understanding & Building Simple Application in Flask

Flask

There are many modules or frameworks which allows to build your webpage using python like bottle, django, flask etc. But the real popular ones are Flask. Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It makes the process of designing a web application simpler. Flask lets us focus on what the users are requesting and what sort of response to give back.

Web Server Gateway Interface (WSGI)

The Web Server Gateway Interface (WSGI) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language.

Jinja2

Jinja is a web template engine for the Python programming language. A web templating system combines a template with a certain data source to render dynamic web pages.

My work

You can find detailed explanation of the flask as well as simple application which I have built using flask here in this repository.

Sam09DS commented 3 years ago

What is Flask?

Finally done Screenshot (31)

SathvickN commented 3 years ago

We need to have python installed to use flask. Once you have python install flask using the following command. pip install Flask

We can use HTTP methods in Flask. HTTP protocol is the foundation of data communication in world wide web. Different methods of data retrieval from specified URL are defined in this protocol. The methods are described down below.

1 GET It is the most common method which can be used to send data in the unencrypted form to the server.

2 HEAD It is similar to the GET but used without the response body.

3 POST It is used to send the form data to the server. The server does not cache the data transmitted using the post method.

4 PUT It is used to replace all the current representation of the target resource with the uploaded content.

5 DELETE It is used to delete all the current representation of the target resource specified in the URL.

By default, the Flask route responds to the GET requests. However, this can be altered by providing methods argument to route() decorator. Python and HTML code is here. https://github.com/SathvickN/Flask_beginner

Ajay0511 commented 3 years ago

What is Flask

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions.

Installation Type 'pip install flask' in command prompt

My Work

Code Link https://github.com/Ajay0511/DevIncept-AI/tree/main/Task_1_FlaskApp

jaikushwaha7 commented 3 years ago

Flask-App-Building-Steps

Flask initial task

Flask App Building with Python

  1. Start the app building by going to folder where you want to save code. In my case: `D:>cd D:\Study\Internsala\Devincept\Devincept Intership AI

D:\Study\Internsala\Devincept\Devincept Intership AI>mkdir app5

D:\Study\Internsala\Devincept\Devincept Intership AI>cd app5`

  1. Created a new environment as venv py -3 -m venv venv

  2. Activated with the following script venv\Scripts\activate

  3. Installed the flask package using: pip install flask

  4. Written the flask code in python using spyder interface as app.py. [https://github.com/jaikushwaha7/Flask-App-Building-Steps/blob/main/app2.py].

  5. Set the flask app by connecting to app2.py and running it. set FLASK_APP=app2.py flask run

  6. On running the code and link was provided where the output of the app was displayed in a HTML format. Output 2

So Flask a simple python web application framework that allows us to build up web-applications.

rojatv5 commented 3 years ago

What is Flask?

Flask is a web framework, it’s a Python module that lets you develop web applications easily. It’s has a small and easy-to-extend core: it’s a microframework that doesn’t include an ORM (Object Relational Manager) or such features.

It does have many cool features like routing, template engine. It is a WSGI web app framework.

Related course: Python Flask: Create Web Apps with Flask

What is a Web Framework? A Web Application Framework or a simply a Web Framework represents a collection of libraries and modules that enable web application developers to write applications without worrying about low-level details such as protocol, thread management, and so on.

What is Flask? Flask is a web application framework written in Python. It was developed by Armin Ronacher, who led a team of international Python enthusiasts called Poocco. Flask is based on the Werkzeg WSGI toolkit and the Jinja2 template engine. Both are Pocco projects.

WSGI The Web Server Gateway Interface (Web Server Gateway Interface, WSGI) has been used as a standard for Python web application development. WSGI is the specification of a common interface between web servers and web applications.

Werkzeug Werkzeug is a WSGI toolkit that implements requests, response objects, and utility functions. This enables a web frame to be built on it. The Flask framework uses Werkzeg as one of its bases.

jinja2 jinja2 is a popular template engine for Python. A web template system combines a template with a specific data source to render a dynamic web page.

Flask 1 .docx http://127.0.0.1:5000/ shows the output "Hello World"