您的位置:首页 > 其它

工作总结

2015-10-16 14:32 288 查看
1.在源文件的头部添加入: # coding: utf-8 可解决中文编译不通过的问题

2.错误提示:IndentationError: unindent does not match any outer indentation level
出现这个错误是因为语法中有Tab与空格混合使用,改为统一的模式即可

3.scp /home/feiniu/luchangyin/jiaozinan.html zinan@192.168.1.113:/home/zinan 从本机复制到相应的机子去 在相应的机子上运行次命令:sudo apt-get install openssh-server

4.克隆用 git clone 项目链接

创建虚拟环境: mkvirtualenv 项目名称

安装flask: pip install flask-script

ImportError: No module named flask.ext.admin: pip install git+https://github.com/flask-admin/flask-admin.git

ImportError: No module named lxml.etree: pip install lxml

ImportError: No module named tldextract: pip install tldextract

ImportError: No module named BeautifulSoup: pip install BeautifulSoup

5.创建文件夹 mkdir -p /home/yy/abc

6.设置 sublime 的 tab 自动转换为空格: preferences -> settings-users ->
{
"font_size": 12,
"tab_size": 4,
"translate_tabs_to_spaces": true
}

7.更新项目 :
方法一:
如果不在chiki目录,先进入该目录 cd ~/chiki ->git stash && git pull (强制覆盖,如果还出错,往下操作)
->git config --global user.email "changyinlu_316@163.com" -> git config --global user.name "feiniu" ->git stash && git pull ->pip install -r requirements.txt (如果提示这个错误ErrorImport lxml.etree,就执行这句语句)

运行项目后出现这个错误:TypeError: formatter_link() got an unexpected keyword argument 'html',表明chiki没更新完 ->python setup.py install

方法二:
PYTHONPAT ->pip install git+https://github.com/endsh/chiki.git#egg=chiki ->pip install git+https://github.com/endsh/chiki.git#egg=chiki --upgrade ->exit

8.查 IP: ifconfig

9.导入项目的数据与运行
导入:
feiniu@feiniu-pc:~/suoping$ cd ~
feiniu@feiniu-pc:~$ mongorestore -d suoping suoping-data
运行:
feiniu@feiniu-pc:~/suoping$ workon suoping
(suoping)feiniu@feiniu-pc:~$ cd suoping
(suoping)feiniu@feiniu-pc:~/suoping$ mongo-start

(suoping)feiniu@feiniu-pc:~/suoping$ python src/manage.py runweb -d

(suoping)feiniu@feiniu-pc:~/suoping$ python src/manage.py runadmin -d (后台)

10.更新chiki框架

cd ~/
cd chiki
git pull
workon feizhuan
python setup.py install

更新相关依赖包:
pip install git+https://github.com/endsh/chiki.git

11.飞转项目更新到gitlab和布署到服务器的步骤

1.增加修改到本地:git add --all
2.说明日志:git commit -m "积分墙接口"
3.push到gitlab上:git push -u origin master
4.进入项目的deploy文件夹中: cd deploy/
5.布署到服务器: fab update && fab restart

相反,从gitlab更新到本地:(先进入到项目要目录)->git stash && git pull (注:git stash 覆盖现有项目冲突的内容)

12.运行API

(feizhuan)feiniu@feiniu-pc:~/git/web/feizhuan$ python manage.py api -d -r

13.操作本地数据库

1.feiniu@feiniu-pc:~/git/web/feizhuan$ mongo
2.connecting to: test
3.> show dbs
4.> use feizhuan
5.> db.offer.find()
6.> db.offer.drop() [清空数据表]

14.操作服务端数据库

1.feiniu@feiniu-pc:~/git/web/feizhuan$ ssh feizhuan@chiki.org
2.Are you sure you want to continue connecting (yes/no)? yes
3.(feizhuan)feizhuan@AY140613174917791637Z:~/feizhuan$ su root
4.Password:
5.root@AY140613174917791637Z:/home/feizhuan/feizhuan# chmod -R 755 ~/mongodb
6.root@AY140613174917791637Z:/home/feizhuan/feizhuan# exit
7.(feizhuan)feizhuan@AY140613174917791637Z:~/feizhuan$ /root/mongodb/bin/mongo
8.(feizhuan)feizhuan@AY140613174917791637Z:~/feizhuan$ su root
9.Password:
10.root@AY140613174917791637Z:/home/feizhuan/feizhuan# ls -al
11.root@AY140613174917791637Z:/home/feizhuan/feizhuan# /root/mongodb/bin/mongo
12.connecting to: test
13.> show dbs
14.> use feizhuan
15.> show collections
16.> db.offer
17.> db.offer.find()
18.> db.offer.update({}, {$unset:{module:''}}) [设置module字段为空]

15.部署项目之后,记得把写过的 API 导入到 ~/git/web/feizhuan/feizhuan/api.py中去: from . import common, users, logs, articles, offers (积分墙接口路径:@api.resource('/offers'))

16.卸载与更新chiki
pip uninstall chiki
pip install git+https://github.com/endsh/chiki.git

17.部署项目
一:(feizhuan)feiniu@feiniu-pc:~/git/web/feizhuan$ cd deploy/
(feizhuan)feiniu@feiniu-pc:~/git/web/feizhuan/deploy$ fab sync:"网页渲染" restart

二:手动部署
git pull
cd ..
git add --all
git commit -m "排行版修改"
git push -u origin master
cd deploy/
fab update && fab restart
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: