1.install pip
###############################################
# yum -y install epel-release
# yum -y install python-pip
# pip install --upgrade pip
# pip --version
pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)
#
2.install flask
###############################################
# pip install flask
Collecting flask
Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
100% |████████████████████████████████| 92kB 264kB/s
Collecting click>=2.0 (from flask)
Downloading click-6.7-py2.py3-none-any.whl (71kB)
100% |████████████████████████████████| 71kB 1.6MB/s
Collecting Jinja2>=2.4 (from flask)
Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
100% |████████████████████████████████| 348kB 3.2MB/s
Collecting Werkzeug>=0.7 (from flask)
Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
100% |████████████████████████████████| 317kB 1.0MB/s
Collecting itsdangerous>=0.21 (from flask)
Downloading itsdangerous-0.24.tar.gz (46kB)
100% |████████████████████████████████| 51kB 2.0MB/s
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask)
Downloading MarkupSafe-1.0.tar.gz
Installing collected packages: click, MarkupSafe, Jinja2, Werkzeug, itsdangerous, flask
Running setup.py install for MarkupSafe ... done
Running setup.py install for itsdangerous ... done
Successfully installed Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 flask-0.12.2 itsdangerous-0.24
#
3. git repository usage
# yum install -y git
1). 初始化git repository
首先github建立代码仓库
### initial git
本地代码库/opt/firstapp/py_web,远程代码库地址 https://github.com/longtian001/py_web
# cd /opt/firstapp(代码库存放目录)
### def remote origin
# git remote add origin https://github.com/longtian001/py_web
### get remote repository to local
# git clone https://github.com/longtian001/py_web
### watch remote git
# git remote -v
origin https://github.com/longtian001/py_web (fetch)
origin https://github.com/longtian001/py_web (push)
2).所有文件初次提交远程git repository)
# cd py_web
# git add . (将改动添加到暂存区)
# git commit -m "init prog"
# git push origin master 将本地更改推送到远程master分支。
3).添加新的文件
py_web文件夹添加了新的代码文件
# git add newfile_name (将改动添加到暂存区)
# git commit -m "add new file"
# git push origin master 将本地更改推送到远程master分支。
4).修改同名文件后提交
如果在github的remote上已经有了文件,会出现错误。
此时应当先pull一下,即:
# git add .
# git commit -m "modify add flask"
# git pull origin master
然后再进行:
# git push origin master
5).删除文件
# git rm *.py -r
rm ‘hello.py‘
rm ‘hello02.py‘
# git commit -m "rm py files"
[master 9f6ea78] rm py files
Committer: longtian001 <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email [email protected]
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
2 files changed, 16 deletions(-)
delete mode 100644 hello.py
delete mode 100644 hello02.py
# git push origin master
Username for ‘https://github.com‘: 输入用户名
Password for ‘https://[email protected]‘: 输入密码
Counting objects: 3, done.
Compressing objects: 100% (1/1), done.
Writing objects: 100% (2/2), 238 bytes | 0 bytes/s, done.
Total 2 (delta 0), reused 0 (delta 0)
To https://github.com/longtian001/py_web
e71fc04..9f6ea78 master -> master
#