Getting Started with Web development tutorial: Pycharm easily create Flask project
Pycharm open the file, choose to create a new project, then the dialog box, we can see that there are many cases, Flask, Django, and so we chose the demo program generates Flask
After selecting to create a simple project Flask appeared in front of us, the first one is the entrance procedures, as well as a static static directory, templates are stored in the template location
We can manually start this Flask project, but this is not very sensible, there is a run in Pycharm above, we can choose to start the run Flask service is turned on by default port 5000
Point your browser to http: // localhost: 5000, view the health Web site, the page output hello world we returned
Update our route, add a route of a test, and then add a test route / name of, name here is variable, we can easily enter and pass it to the template file test.html by render_template
templates / test.html template files, variables with two braces, the render_template function will then renders the template variable output
Restart the project, point your browser to http: // localhost: 5000 / test /, view the health Web site, the page output your name is: None, shows that our name is None, then we transform what name, type http: // localhost: 5000 / test / lisi, page content changes, and output your name is: lisi