Pycharm 简明教程

Pycharm - Flask

PyCharm 支持 Flask 框架开发。你可以通过欢迎界面创建新的项目来轻松创建新的 Flask 项目。你可以设置项目的路径和虚拟环境,并选择模板语言和模板路径。

PyCharm supports Flask framework development. You can easily create a new Flask project by creating new project through welcome screen. You can set the project’s location and the virtual environment and choose a template language and where the templates will be located.

flask framework

你可以使用 Run → Run ‘<project-name>’ 运行项目。

You can run a project by using Run → Run ‘<project-name>’.

你还可以用此框架添加新的数据源。我们创建一个名为 squema.sql 的文件,并添加 SQL 代码以创建一些表。PyCharm 编辑器将识别这些文件,并要求你配置数据源并设置为数据库方言。

You can also add a new data source with this framework. Let us create a file called squema.sql and add SQL code to create some tables. PyCharm editor will recognize the files and asks you to configure a data source and set up to the database dialect.

squema

PyCharm 将允许你选择想要使用的所需方言。你可以更改 SQL 的属性 Settings → Language and Frameworks → SQL Dialects

PyCharm will let you choose the desired dialect that you want to use. You can change the properties of the SQL: Settings → Language and Frameworks → SQL Dialects

language framework

对于 flask 编辑器,运行 SQL 查询最简单的方法是单击查询中的某个位置,然后单击检查窗口并单击“运行查询进入控制台”。

For flask editor, the easiest way to run the SQL query is to click somewhere in the query and click on the inspection window and click “Run Query into console “.

run query

Flask 框架的用户界面如下所示−

The user interface of the Flask framework is displayed as below −

flask display