py_web---github代碼庫使用
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
#
本文出自 “yiyi” 博客,請務必保留此出處http://heyiyi.blog.51cto.com/205455/1958603
py_web---github代碼庫使用