当前位置:网站首页>[flask tutorial] flask overview
[flask tutorial] flask overview
2022-06-25 12:56:00 【Coconut brine Engineer】
Flask brief introduction
Flask It's a use python Written lightweight “ Microkernel ”web Application framework .
How to understand microkernel ?
the “micro” in microframework means Flask aims to keep the core simple but extensible.
contrast Django The difference between the following :
Flask Development environment construction
python Package management tools
- eazy_install
- pip( recommend )
️ Be careful :python Global installation only
- advantage : Just install it once , It can be used in other projects , Avoid re installation .
- shortcoming : Used in part of the project python The versions are different .
pip Common commands
- pip install
- pip uninstall
- pip list
mac Development environment construction
Use pip install Flask:pip install flask
Flask development tool
It is said that “ A good workman does his work well , You must sharpen your tools first ”
Common plain text development tools
- Notepad++
- Sublime
- Emacs
- Vim( recommend )
Configuration base Vim Of python development environment
- Vundle:Vim Management plug-in
- YouCompleteMe: Powerful auto completion plug-ins
- NERDTree: Inter file jump plug-in
- Vim-Jinja2-Syntax: Syntax enhancement plug-in
Vundle
Install source :git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
To configure :$vim ~/.vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {
'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {
'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
Start plug-in installation :

Write the first flask application
$ vim app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
$ python hello.py function
Common integrated development environments
- Microsoft Visual Studio
- Eclipse + pydev
- Pycharm ( recommend )
1、 Create a flask project 
2、 Realization "Hello world"
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()

边栏推荐
猜你喜欢

Guess Tongyuan B

Differences between JS and JQ operation objects

Meichuang was selected into the list of "2022 CCIA top 50 Chinese network security competitiveness"
模块五(微博评论)

nacos无法修改配置文件Mysql8.0的解决方法

2021-09-28

Singleton mode in PHP to reduce memory consumption

Three jobs! You can learn this from me (attached with graduation vlog)

3+1保障:高可用系统稳定性是如何炼成的?

First acquaintance with CANopen
随机推荐
Render values to corresponding text
三入职场!你可以从我身上学到这些(附毕业Vlog)
Meichuang was selected into the list of "2022 CCIA top 50 Chinese network security competitiveness"
Oracle backup or restore database (expdp, impdp)
Lexical trap
Geospatial search - > R tree index
Wechat full-text search technology optimization
JS picture switching (simple and practical)
利用cmd(命令提示符)安装mysql&&配置环境
C program linking SQLSERVER database: instance failed
Guess Tongyuan B
剑指 Offer 第 1 天栈与队列(简单)
torch. Tensor splicing and list (tensors)
冷启动的最优解决方案
list. replace, str.append
Talk about 11 key techniques of high availability
英语口语 - 弱读
20220620 interview reply
The editor is used every day. What is the working principle of language service protocol?
(6) Pyqt5--- > window jump (registration login function)