{"id":8680,"date":"2022-01-03T17:59:55","date_gmt":"2022-01-03T16:59:55","guid":{"rendered":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/?p=8680"},"modified":"2022-10-20T11:18:44","modified_gmt":"2022-10-20T09:18:44","slug":"how-to-create-web-app-with-python-and-flask","status":"publish","type":"post","link":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/","title":{"rendered":"How to Create web app with Python and Flask"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\">Creating web app, especially if you are a beginner with programming, always requires a good knowledge of the languages used and of the development methodologies that connect the client-side world and the server-side world. If you have already developed web applications in the past, for example with PHP, you will certainly have noticed that you need a web server and a database server external to the application to be created. That is, we are talking about third-party applications that must be installed and managed separately.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">In case you decide to create a website with Python and Flask, know that both the web server and the database server are applications already included in the web application you are about to create and do not require external configuration or management.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Those who approach Python for the first time have the impression that it is only a scripting language for the execution of procedures to be tested on the fly. In reality, Python is a language that lends itself very well to a countless type of applications, including the creation of websites.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">In questo articolo:<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/#1_Why_build_a_website_with_Python_and_Flask\" >1. Why build a website with Python and Flask<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/#2_Install_the_Flask_module\" >2. Install the Flask module<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/#3_Build_your_first_web_app_with_Python_and_Flask\" >3. Build your first web app with Python and Flask<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/#4_Start_the_Flask_server_and_run_the_Python_script\" >4. Start the Flask server and run the Python script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/#5_Invoke_html_files_with_Flask_and_execute_Python_code\" >5. Invoke html files with Flask and execute Python code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/#6_Passing_data_to_the_html_file_from_a_script_in_Python\" >6. Passing data to the html file from a script in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/#7_Access_to_database_with_Flask_in_Python\" >7. Access to database with Flask in Python<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Why_build_a_website_with_Python_and_Flask\"><\/span><strong>1. Why build a website with Python and Flask<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Creating a website with Python is very simple thanks to the use of ad hoc frameworks, among these frameworks Django and Flask are of great importance. Both frameworks make Python an attractive language in the world of professional web development and in the creation of opensource management software, as these frameworks are free and open to use.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">To build a website with Python, I decided to use the Flask library. This is because unlike Django, Flask is a framework that supports APIs and has the ability to interact with a wide range of databases. Suffice it to say that it is currently used by companies of the caliber of Netflix, moreover, social webs like reddit are written and managed entirely in Flask.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Through <a href=\"https:\/\/flask.palletsprojects.com\/en\/2.0.x\/\" target=\"_blank\" rel=\"noreferrer noopener\">Flask<\/a> it is possible to create entire websites using only and exclusively Python code without the aid of web servers and complex data management systems such as MySQL and SQL Server. In fact, Flask incorporates a powerful web server and database engine, widely used for both mobile applications and small and medium-sized web applications. The database used is SQLite, also serverless, basically a web application written with Python and Flask has the web server and the SQLite database server that are part of the application itself.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now you will see, step by step, how to build a website with Python and Flask. To create this website you will only need an internet connection and a text editor. As always, I recommend Visual Studio Code.<\/p>\n\n\n\n<figure class=\"wp-block-pullquote\"><blockquote><p>READ MORE: <a href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/the-best-way-to-query-sql-server\/\" target=\"_blank\" rel=\"noreferrer noopener\">The best way to Query SQL SERVER<\/a>.<\/p><\/blockquote><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Install_the_Flask_module\"><\/span><strong>2. Install the Flask module<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">As I mentioned earlier Flask is a web framework for Python. Furthermore, it is a library that provides a set of classes and functions specially designed to build websites in a very short time.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Like any module and library for Python, it is necessary to install the entire library through the pip3 command, to be run within the command console, for Windows environment, or from the terminal, for Linux or &nbsp;<a href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/velocizzare-il-macbook-2\/\">MacOS<\/a>\u00a0 operating systems. Then, open the terminal and type the command <strong>pip3 install flask<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"450\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/installazione-libreria-flask.png\" alt=\"\" class=\"wp-image-8616\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/installazione-libreria-flask.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/installazione-libreria-flask-300x169.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/installazione-libreria-flask-768x432.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">After a few moments, the installation of the Flask module will be completed. From now on, we can import Flask into any Python script and set the entire framework in motion to build interactive websites.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Build_your_first_web_app_with_Python_and_Flask\"><\/span><strong>3. Build your first web app with Python and Flask<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">To create your first website with Python and Flask you need to create a folder where your web project will come to life. So, as a first step create a folder on your desktop, call it flask-app but consider that you can give it a name of your own.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, open Visual Studio Code, or if you prefer another text editor, and create a file called app.py. Why app.py? Well the app.py file is the file that Flask looks for by default within the web project folder and which is considered the starting point for the entire website. I don&#8217;t know if you&#8217;ve ever heard of controllers and MVC applications, here, app.py is your controller.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, type in the file, app.py, these instructions in pure Python code:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"212\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/creazione-file-app.py_-800x212.png\" alt=\"create web app \" class=\"wp-image-8618\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/creazione-file-app.py_-800x212.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/creazione-file-app.py_-300x80.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/creazione-file-app.py_-768x204.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/creazione-file-app.py_-1536x408.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/creazione-file-app.py_.png 2042w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">From the code you can see some very interesting instructions. The first line of code allows you to import the flask class from the library of the same name. The second line of code instantiates the Flask object that will govern the entire life cycle of your web app.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Things start to get more interesting from the third line onwards, that is, from the @ app.route (&#8216;\/&#8217;) line. This line inserted before a function, in this case the function index (), defines the default route, which when intercepted, will invoke index () and process the instructions declared inside it, that is, <strong>return &#8216;Hello World \u2026!&#8217;<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Start_the_Flask_server_and_run_the_Python_script\"><\/span><strong>4. Start the Flask server and run the Python script<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">At this point you can already test if your first website written in Python and Flask works. Then, open your terminal and navigate to the path of the <strong>flask-app<\/strong> folder, which contains the entire web project. At this point all you have to do is start the web server by typing the command <strong>flask run.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/avvia-server-flask.png\" alt=\"create web app with python\" class=\"wp-image-8619\" width=\"865\" height=\"209\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/avvia-server-flask.png 1730w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/avvia-server-flask-300x72.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/avvia-server-flask-800x193.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/avvia-server-flask-768x186.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/avvia-server-flask-1536x371.png 1536w\" sizes=\"auto, (max-width: 865px) 100vw, 865px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Ok, the Flask web server is started successfully. As if by magic, Flask also gives you the URL related to your web project. Then, type the address provided by the <strong>flask run<\/strong> command, highlighted in red in the figure and which identifies the default route, in the address bar of your favorite web browser. Press the <strong>ENTER<\/strong> key and you will see the processing of the function <strong>index ()<\/strong> displayed in the active browser window.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser.png\" alt=\"create web app with python\" class=\"wp-image-8621\" width=\"822\" height=\"261\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser.png 1096w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser-300x95.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser-800x254.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser-768x244.png 768w\" sizes=\"auto, (max-width: 822px) 100vw, 822px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-pullquote\"><blockquote><p>READ MORE: <a href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/web-app-development-with-wordpress-php-and-codeless-framework\/\" target=\"_blank\" rel=\"noreferrer noopener\">Web app development with WordPress, PHP and CodeLess Framework.<\/a><\/p><\/blockquote><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Invoke_html_files_with_Flask_and_execute_Python_code\"><\/span><strong>5. Invoke html files with Flask and execute Python code<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, suppose you wanted to recall an html file, perhaps downloaded from the many websites that allow the free download of files ready to be inserted into your web project. In short, the classic <strong>HTML template<\/strong>.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">At this point let&#8217;s see how to proceed. First, create a folder with the default name templates inside the <strong>flask-app<\/strong> folder. <strong>Templates<\/strong> is the folder Flask looks for by default to load and render your HTML templates. Then, within the templates folder you will create your HTML pages, the views, which you will recall from the functions contained within the app.py file. By convention, I recommend that you rename the HTML template with the same name as the function that will call it.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Since<strong> index () <\/strong>is the name of the function that will call your first HTML template, you will create the <strong>index.html<\/strong> file, inside the <strong>templates<\/strong> <strong>folder<\/strong>, with this content:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"221\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/contenuto-del-primo-template-flask-800x221.png\" alt=\"create web app with python e flask\" class=\"wp-image-8623\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/contenuto-del-primo-template-flask-800x221.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/contenuto-del-primo-template-flask-300x83.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/contenuto-del-primo-template-flask-768x212.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/contenuto-del-primo-template-flask-1536x424.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/contenuto-del-primo-template-flask.png 2044w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now, to invoke a template from the controller, that is, from the app.py file, you need to modify the contents of the app.py file as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"219\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/richiamo-del-file-html-con-flask-800x219.png\" alt=\"create web app\" class=\"wp-image-8625\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/richiamo-del-file-html-con-flask-800x219.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/richiamo-del-file-html-con-flask-300x82.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/richiamo-del-file-html-con-flask-768x210.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/richiamo-del-file-html-con-flask-1536x420.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/richiamo-del-file-html-con-flask.png 2046w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Note that the import of the <strong>render_template function<\/strong> has been added to the import clause and that the return command will now return the contents of the index.html page by calling the render_template function. Refresh the web page and you will notice that nothing has changed at the view level but now, flask has displayed the message <strong>Hello World ..!<\/strong>, Calling up an html page, that is, a view.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"254\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser-1-800x254.png\" alt=\"create web app\" class=\"wp-image-8627\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser-1-800x254.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser-1-300x95.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser-1-768x244.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-dello-script-flask-nel-browser-1.png 1096w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_Passing_data_to_the_html_file_from_a_script_in_Python\"><\/span><strong>6. Passing data to the html file from a script in Python<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Flask, like other web frameworks, is used to create interactive web pages, that is, pages whose content changes based on information contained in Python objects or variables.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">It is not uncommon to be in a position to create an app.py controller function that passes entire objects to its template. Therefore, it is necessary to modify the <strong>return<\/strong> <strong>statement<\/strong> of the index function and add the objects or variables to be passed to the template as additional parameters of the render_template function:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"190\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/passaggio-parametri-da-script-python-800x190.png\" alt=\"create web app\" class=\"wp-image-8628\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/passaggio-parametri-da-script-python-800x190.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/passaggio-parametri-da-script-python-300x71.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/passaggio-parametri-da-script-python-768x182.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/passaggio-parametri-da-script-python-1536x365.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/passaggio-parametri-da-script-python.png 2048w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Here too you can see that the two string variables, name and surname, are passed to the render_template function which will forward them to the template. After appropriately modifying the app.py controller, it is also necessary to make changes to the template, that is, to the index.html file. Then, edit the index.html file, contained within the templates folder, as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"189\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/lettura-parametri-da-file-html-800x189.png\" alt=\"create web app\" class=\"wp-image-8630\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/lettura-parametri-da-file-html-800x189.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/lettura-parametri-da-file-html-300x71.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/lettura-parametri-da-file-html-768x181.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/lettura-parametri-da-file-html-1536x362.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/lettura-parametri-da-file-html-2048x483.png 2048w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">As mentioned previously, index.html has also been changed, this time however, we see the appearance of double curly brackets. This is because all the variables passed from the controller to the template to be interpreted within index.html must be enclosed in double curly brackets. After the modifications of the affected files, update the web page displayed by the browser that will display this screen:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-script-passaggio-dati-da-script.png\" alt=\"create web site\" class=\"wp-image-8632\" width=\"656\" height=\"375\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-script-passaggio-dati-da-script.png 1312w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-script-passaggio-dati-da-script-300x171.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-script-passaggio-dati-da-script-787x450.png 787w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/esecuzione-script-passaggio-dati-da-script-768x439.png 768w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The browser will display the greeting but this time some of the data has been passed to the template by the controller.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7_Access_to_database_with_Flask_in_Python\"><\/span><strong>7. Access to database with Flask in Python<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">As in all web app, access to a database is sometimes required to read and store data in tables contained in an SQL database. This time however, there is no need to download and install relational databases such as MySQL and SQL Server. The database managed by Flask by default is SQLite. To use SQLite, in a web project, you only need to import the <strong>SQLite<\/strong> library into the app.py controller.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Even if your relational database engine, SQLite, is immediately ready for use, you must first create a database and at least one table to be able to manage it later from Flask. For this reason, you need to create a script containing all database and table generation SQL statements. For the purposes of this guide we will call the database, database.db, and we will call the table, registry. Therefore create the file <strong>crea_db.sql<\/strong>, in the same location as the <strong>app.py<\/strong> file, and insert the following SQL statements.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"208\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-sql-per-creare-database-sqlite-800x208.png\" alt=\"create database with script sql\" class=\"wp-image-8633\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-sql-per-creare-database-sqlite-800x208.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-sql-per-creare-database-sqlite-300x78.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-sql-per-creare-database-sqlite-768x199.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-sql-per-creare-database-sqlite-1536x399.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-sql-per-creare-database-sqlite-2048x531.png 2048w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">As you can see inside this file, statements in pure SQL code have been inserted, nothing to do with Python. These statements will be executed by SQLite through a properly designed Python script. Then, create another file, still in the same location as the <strong>create_db.sql<\/strong> file and rename it to <strong>init_db.py<\/strong> like so:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"220\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-python-per-eseguire-script-sql-800x220.png\" alt=\"create web site\" class=\"wp-image-8635\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-python-per-eseguire-script-sql-800x220.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-python-per-eseguire-script-sql-300x83.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-python-per-eseguire-script-sql-768x212.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-python-per-eseguire-script-sql-1536x423.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/istruzioni-python-per-eseguire-script-sql-2048x564.png 2048w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The init_db.py script will create the database and execute the SQL statements contained in the crea_db.sql file. Now, you just have to run the init_db.py script, from the terminal, with this command: python3 init_db.py<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Once the init_db.py script has been executed, you will notice the presence of the database.db file inside the flask-app folder. Now, to read the callsigns from the database you have to change the controller, i.e. the app.py file, as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"238\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/leggere-database-sqlite-da-python-800x238.png\" alt=\"create web app\" class=\"wp-image-8637\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/leggere-database-sqlite-da-python-800x238.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/leggere-database-sqlite-da-python-300x89.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/leggere-database-sqlite-da-python-768x229.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/leggere-database-sqlite-da-python-1536x457.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/leggere-database-sqlite-da-python-2048x609.png 2048w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Even if you&#8217;re just starting out with programming, you won&#8217;t have much trouble interpreting the code inside the app.py controller. In fact, you will be able to locate the Python commands for creating the database, database.db, and the command to invoke the SQL query, &#8220;select * from anagrafica&#8221;, which will return all three records entered during the initialization phase of the database and the table registry with the init_db.py script. Every time you make a change to the database you will update both the crea_db.sql file and the init_db.py file and you will run the init_db.py script from the terminal.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">In addition to the controller to view the contents of the personal data table in the database, database.db, you must also change the template, namely the index.html file, as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"240\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/visualizzare-dati-del-database-nel-file-html-800x240.png\" alt=\"create web app\" class=\"wp-image-8639\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/visualizzare-dati-del-database-nel-file-html-800x240.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/visualizzare-dati-del-database-nel-file-html-300x90.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/visualizzare-dati-del-database-nel-file-html-768x231.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/visualizzare-dati-del-database-nel-file-html-1536x462.png 1536w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/visualizzare-dati-del-database-nel-file-html-2048x615.png 2048w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Refresh the browser window and the dynamic content will be displayed:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/dati-del-database-visualizzati-dal-browser.png\" alt=\"create web app\" class=\"wp-image-8640\" width=\"787\" height=\"377\" srcset=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/dati-del-database-visualizzati-dal-browser.png 1574w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/dati-del-database-visualizzati-dal-browser-300x144.png 300w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/dati-del-database-visualizzati-dal-browser-800x383.png 800w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/dati-del-database-visualizzati-dal-browser-768x368.png 768w, https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2021\/12\/dati-del-database-visualizzati-dal-browser-1536x736.png 1536w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">As you have noticed with very few Python instructions and thanks to <a href=\"https:\/\/flask.palletsprojects.com\/en\/2.0.x\/\" target=\"_blank\" rel=\"noreferrer noopener\">Flask<\/a> it is possible to create websites in a very short time. The example proposed in this guide shows only a small part of the potential of Flask. Flask is a very powerful framework that you can learn more by consulting this guide. If you want to know Django, another very powerful and free web framework for Python, you can follow this short video tutorial where you will have the opportunity to learn the techniques used by web development professionals.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Python Django Web Framework - Full Course for Beginners\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/F5mRW0jo-U4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><figcaption><a href=\"https:\/\/youtu.be\/F5mRW0jo-U4\" target=\"_blank\" rel=\"noreferrer noopener\">python Django web framework<\/a><\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Building a website has never been easier. With Flask and Python you can create free management software in a very short time.<\/p>\n","protected":false},"author":1,"featured_media":8710,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[268,1059],"tags":[2810,5187,2941,2937,2835,5181,2945,2839,2841,2843,5184,2845],"class_list":["post-8680","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles-en","category-development","tag-development-en","tag-framework-en","tag-how-en","tag-how-to-en","tag-html-en","tag-microsoft-en","tag-software-en","tag-to-en","tag-tutorial-en","tag-video-en","tag-visual-studio-code-en","tag-web-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create web app with Python and Flask<\/title>\n<meta name=\"description\" content=\"Create web app has never been easier. With Flask and Python you can create free management software in a very short time.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create web app with Python and Flask.\" \/>\n<meta property=\"og:description\" content=\"Building a website has never been easier. With Flask and Python you can create free management software in a very short time.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/\" \/>\n<meta property=\"og:site_name\" content=\"Antonio Lamorgese\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-03T16:59:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-20T09:18:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2022\/01\/How-to-Create-web-app-with-Python-and-Flask.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Antonio Lamorgese\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Create web app with Python and Flask.\" \/>\n<meta name=\"twitter:description\" content=\"Building a website has never been easier. With Flask and Python you can create free management software in a very short time.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2022\/01\/How-to-Create-web-app-with-Python-and-Flask.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@AntonioLamorge3\" \/>\n<meta name=\"twitter:site\" content=\"@AntonioLamorge3\" \/>\n<meta name=\"twitter:label1\" content=\"Scritto da\" \/>\n\t<meta name=\"twitter:data1\" content=\"Antonio Lamorgese\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo di lettura stimato\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask\\\/\"},\"author\":{\"name\":\"Antonio Lamorgese\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#\\\/schema\\\/person\\\/264cf3af38edc93a3362a4c47ec5b2f0\"},\"headline\":\"How to Create web app with Python and Flask\",\"datePublished\":\"2022-01-03T16:59:55+00:00\",\"dateModified\":\"2022-10-20T09:18:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask\\\/\"},\"wordCount\":2042,\"publisher\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#\\\/schema\\\/person\\\/264cf3af38edc93a3362a4c47ec5b2f0\"},\"image\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/How-to-Create-web-app-with-Python-and-Flask.jpg\",\"keywords\":[\"development\",\"framework\",\"how\",\"how to\",\"html\",\"microsoft\",\"software\",\"to\",\"tutorial\",\"video\",\"Visual Studio Code\",\"web\"],\"articleSection\":[\"Blog Articles\",\"Development\"],\"inLanguage\":\"it-IT\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask\\\/\",\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask\",\"name\":\"How to Create web app with Python and Flask\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/How-to-Create-web-app-with-Python-and-Flask.jpg\",\"datePublished\":\"2022-01-03T16:59:55+00:00\",\"dateModified\":\"2022-10-20T09:18:44+00:00\",\"description\":\"Create web app has never been easier. With Flask and Python you can create free management software in a very short time.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask#primaryimage\",\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/How-to-Create-web-app-with-Python-and-Flask.jpg\",\"contentUrl\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/How-to-Create-web-app-with-Python-and-Flask.jpg\",\"width\":800,\"height\":450,\"caption\":\"create web app with python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/how-to-create-web-app-with-python-and-flask#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Blog Articles\",\"item\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/category\\\/articles-en\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Create web app with Python and Flask\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#website\",\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/\",\"name\":\"Antonio Lamorgese\",\"description\":\"Il web e i suoi strumenti operativi\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#\\\/schema\\\/person\\\/264cf3af38edc93a3362a4c47ec5b2f0\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#\\\/schema\\\/person\\\/264cf3af38edc93a3362a4c47ec5b2f0\",\"name\":\"Antonio Lamorgese\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/ChiSono.png\",\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/ChiSono.png\",\"contentUrl\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/ChiSono.png\",\"width\":120,\"height\":130,\"caption\":\"Antonio Lamorgese\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/ChiSono.png\"},\"description\":\"Amministratore di rete e sviluppatore. Dopo anni di esperienza nel settore, ho ideato un sistema di gestione dati MYSQL in PHP senza scrivere una sola riga di codice.&nbsp;Scopri di pi\u00f9....\",\"sameAs\":[\"https:\\\/\\\/www.Phpcodewizard.it\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/antonio-lamorgese-660735190\\\/\",\"https:\\\/\\\/pinterest.it\\\/antoniolamorgese9711\\\/\",\"https:\\\/\\\/x.com\\\/AntonioLamorge3\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/antoniolamorgese\",\"https:\\\/\\\/tumblr.com\\\/blog\\\/phpcodewizard\"],\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/author\\\/antonio-lamorgese\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create web app with Python and Flask","description":"Create web app has never been easier. With Flask and Python you can create free management software in a very short time.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/","og_locale":"it_IT","og_type":"article","og_title":"How to Create web app with Python and Flask.","og_description":"Building a website has never been easier. With Flask and Python you can create free management software in a very short time.","og_url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/","og_site_name":"Antonio Lamorgese","article_published_time":"2022-01-03T16:59:55+00:00","article_modified_time":"2022-10-20T09:18:44+00:00","og_image":[{"width":800,"height":450,"url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2022\/01\/How-to-Create-web-app-with-Python-and-Flask.jpg","type":"image\/jpeg"}],"author":"Antonio Lamorgese","twitter_card":"summary_large_image","twitter_title":"How to Create web app with Python and Flask.","twitter_description":"Building a website has never been easier. With Flask and Python you can create free management software in a very short time.","twitter_image":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2022\/01\/How-to-Create-web-app-with-Python-and-Flask.jpg","twitter_creator":"@AntonioLamorge3","twitter_site":"@AntonioLamorge3","twitter_misc":{"Scritto da":"Antonio Lamorgese","Tempo di lettura stimato":"14 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask#article","isPartOf":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/"},"author":{"name":"Antonio Lamorgese","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#\/schema\/person\/264cf3af38edc93a3362a4c47ec5b2f0"},"headline":"How to Create web app with Python and Flask","datePublished":"2022-01-03T16:59:55+00:00","dateModified":"2022-10-20T09:18:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/"},"wordCount":2042,"publisher":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#\/schema\/person\/264cf3af38edc93a3362a4c47ec5b2f0"},"image":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask#primaryimage"},"thumbnailUrl":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2022\/01\/How-to-Create-web-app-with-Python-and-Flask.jpg","keywords":["development","framework","how","how to","html","microsoft","software","to","tutorial","video","Visual Studio Code","web"],"articleSection":["Blog Articles","Development"],"inLanguage":"it-IT"},{"@type":"WebPage","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask\/","url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask","name":"How to Create web app with Python and Flask","isPartOf":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask#primaryimage"},"image":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask#primaryimage"},"thumbnailUrl":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2022\/01\/How-to-Create-web-app-with-Python-and-Flask.jpg","datePublished":"2022-01-03T16:59:55+00:00","dateModified":"2022-10-20T09:18:44+00:00","description":"Create web app has never been easier. With Flask and Python you can create free management software in a very short time.","breadcrumb":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask"]}]},{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask#primaryimage","url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2022\/01\/How-to-Create-web-app-with-Python-and-Flask.jpg","contentUrl":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2022\/01\/How-to-Create-web-app-with-Python-and-Flask.jpg","width":800,"height":450,"caption":"create web app with python"},{"@type":"BreadcrumbList","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/how-to-create-web-app-with-python-and-flask#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/"},{"@type":"ListItem","position":2,"name":"Blog Articles","item":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/category\/articles-en\/"},{"@type":"ListItem","position":3,"name":"How to Create web app with Python and Flask"}]},{"@type":"WebSite","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#website","url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/","name":"Antonio Lamorgese","description":"Il web e i suoi strumenti operativi","publisher":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#\/schema\/person\/264cf3af38edc93a3362a4c47ec5b2f0"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":["Person","Organization"],"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#\/schema\/person\/264cf3af38edc93a3362a4c47ec5b2f0","name":"Antonio Lamorgese","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2019\/06\/ChiSono.png","url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2019\/06\/ChiSono.png","contentUrl":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2019\/06\/ChiSono.png","width":120,"height":130,"caption":"Antonio Lamorgese"},"logo":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2019\/06\/ChiSono.png"},"description":"Amministratore di rete e sviluppatore. Dopo anni di esperienza nel settore, ho ideato un sistema di gestione dati MYSQL in PHP senza scrivere una sola riga di codice.&nbsp;Scopri di pi\u00f9....","sameAs":["https:\/\/www.Phpcodewizard.it\/","https:\/\/www.linkedin.com\/in\/antonio-lamorgese-660735190\/","https:\/\/pinterest.it\/antoniolamorgese9711\/","https:\/\/x.com\/AntonioLamorge3","https:\/\/www.youtube.com\/user\/antoniolamorgese","https:\/\/tumblr.com\/blog\/phpcodewizard"],"url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/author\/antonio-lamorgese\/"}]}},"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/posts\/8680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/comments?post=8680"}],"version-history":[{"count":0,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/posts\/8680\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/media\/8710"}],"wp:attachment":[{"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/media?parent=8680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/categories?post=8680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/tags?post=8680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}