Django中app文件夹中的文件都是干什么用的

Django中app文件夹中的文件都是干什么用的,第1张

C:\Users\用户名\AppData里面一般有三个文件夹,分别是Local,LocalLow,Roaming,简单地来说,都是用来存放软件的配置文件和临时文件的,里面有很多以软件名称或软件公司命名的文件夹,理论上都可以删除。例如,如果安装了PhotoshopCS5,在AppData搜索Adobe,将搜到的文件和文件夹全部删除,然拆差指后启动Photoshop,已删除的文件又会重新生成,但体积变小。删除文件的时候千万要小心,因为AppData同时存放了用户帐户的旅配配置文件。随着系统使用时间的增加和安装软件的增多,AppData占用的空间会越来越大。有一个非常简单的方法可以安全删除AppData整个文件夹,就是删除帐户!更换用户帐户有一个好处是可以“重置”系统,减少垃圾文件,但也会带来不少麻烦,系统好像回到了新安装的状态,某些软件需要重新激活,极个别软件需要重庆含新安装。附:其中三个文件夹的作用,里面的文件可以随心所欲地删除。C:\Users\用户名\AppData\Local\Temp里面是临时文件。C:\Users\用户名\AppData\Local\Microsoft\Windows\TemporaryInternetFiles里面是IE缓存文件(默认是隐藏的)。C:\Users\用户名\AppData\Local\Microsoft\Windows\History里面是浏览器历史记录(默认是隐藏的)。

Django这是什么没听说过,但出现这种问题基本就哗团是两种渗芦者情况丛薯,一种是浏览器将页面缓存了,清一下浏览器缓存。另一种是服务器里储存了项目,去服务器里将原始项目清掉,重新部署进去

一、安装

1、安装第三方epel源

centos 5的epel

rpm -ivh http://mirrors.sohu.com/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpm

rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm

17:01:30 # cat /etc/issue

CentOS release 6.5 (Final)

Kernel \r on an \m

由于是6版本所以安装6的epel

yum install ansible

如果需要自定义module或者想阅读源码、使用最新版本,可以去github里下载源码

git clone https://github.com/ansible/ansible.git

17:22:08 # cd /etc/ansible/

root@ip-10-10-10-10:/etc/ansible

17:23:27 # ll

total 12

-rw-r--r-- 1 root root 5113 Dec 29 03:00 ansible.cfg

-rw-r--r-- 1 root root 965 Dec 29 03:00 hosts

其中ansible.cfg是配置文件,hosts是管理主机信息

17:24:44 # cat hosts

172.17.0.2:49154

172.17.0.4:49155

[zabbix]

172.17.0.2:49154

172.17.0.4:49155

[vpn]

172.17.0.10

16:20:57 # ansible 127* -m ping

SSH password:

127.0.0.1 | success >>{

"changed": false,

"ping": "pong"

}

root@ip-10-10-10-10:/etc/ansible

16:21:05 # ansible 172* -m ping

SSH password:

172.17.0.5 | success >>{

"changed": false,

"ping": "哪型大pong"

}

172.17.0.4 | success >>{

"changed": false,

"ping": "pong"

}

172.17.0.2 | success >>{

"changed": false,

"ping": "pong"

}

如李竖果你有多台服务器的话,想并发运行,可以使用-f参数,默认是并发5

11:30:35 # ansible vpn -m shell -a "echo $TERM" -u test --private-key=denglei -K

SSH password:

sudo password [defaults to SSH password]:

172.17.0.10 | success | rc=0 >>

xterm

11:30:44 # ansible vpn -m copy -a "src=/tmp/server dest=/tmp/server" -u test --private-key=denglei -K

SSH password:

sudo password [defaults to SSH password]:

172.17.0.10 | success >>{

"changed": true,

"dest": "/tmp/server",

"gid": 505,

"group": "租唯test",

"md5sum": "e8b32bc4d7b564ac6075a1418ad8841e",

"mode": "0664",

"owner": "test",

"size": 7,

"src": "/home/test/.ansible/tmp/ansible-1402630447.45-253524136818424/source",

"state": "file",

"uid": 503

}

去客户端查看文件是否传输过来

11:34:57 # ansible vpn -m shell -a "ls -l /tmp/" -u test --private-key=denglei -K

SSH password:

sudo password [defaults to SSH password]:

172.17.0.10 | success | rc=0 >>

total 76

-rw-r--r-- 1 root root 41692 May 21 13:02 config

-rw-r--r-- 1 root root1228 Jun 12 18:24 install_pptpd_vpn.sh

-rw-rw-r-- 1 test test 7 Jun 13 19:33 server

-rw-r--r-- 1 root root 82 Jun 12 18:21 test.log

-rw-r--r-- 1 root root 290 Jun 12 18:21 test.sh

-rw-r--r-- 1 root root2444 Apr 28 2012 vpn_centos6.sh

-rw------- 1 root root 727 Jun 10 18:21 yum_save_tx-2014-06-10-18-21UrqDAp.yumtx

-rw-rw-r-- 1 zabbix zabbix 3124 Jun 12 21:32 zabbix_agentd.log

-rw-rw-r-- 1 zabbix zabbix 5 Jun 12 21:32 zabbix_agentd.pid

11:35:09 # ansible vpn -m shell -a "cat /tmp/server" -u test --private-key=denglei -K

SSH password:

sudo password [defaults to SSH password]:

172.17.0.10 | success | rc=0 >>

server

还有另外一个模块file,可以修改用户与权限

13:50:07 # ansible vpn -m shell -a "ls -l /tmp/server" -u test --private-key=denglei -K

SSH password:

sudo password [defaults to SSH password]:

172.17.0.10 | success | rc=0 >>

-rw-rw-r-- 1 test test 7 Jun 13 19:33 /tmp/server

server文件是664权限,用户与组都是test

13:51:17 # ansible vpn -m file -a "dest=/tmp/server mode=755 owner=root group=root" -u test --private-key=denglei -K

SSH password:

sudo password [defaults to SSH password]:

172.17.0.10 | success >>{

"changed": true,

"gid": 0,

"group": "root",

"mode": "0755",

"owner": "root",

"path": "/tmp/server",

"size": 7,

"state": "file",

"uid": 0

}

root@ip-10-10-10-10:/etc/ansible

13:51:31 # ansible vpn -m shell -a "ls -l /tmp/server" -u test --private-key=denglei -K

SSH password:

sudo password [defaults to SSH password]:

172.17.0.10 | success | rc=0 >>

-rwxr-xr-x 1 root root 7 Jun 13 19:33 /tmp/server

14:20:30 # ansible vpn -m yum -a "name=nmap state=installed" -u test --private-key=denglei -K

SSH password:

sudo password [defaults to SSH password]:

172.17.0.10 | success >>{

"changed": true,

"msg": "",

"rc": 0,

"results": [

"Loaded plugins: fastestmirror, security\nLoading mirror speeds from cached hostfile\n * epel: mirrors.hust.edu.cn\nSetting up Install Process\nResolving Dependencies\n-->Running transaction check\n--->Package nmap.x86_64 2:5.51-3.el6 will be installed\n-->Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n nmap x86_64 2:5.51-3.el6 Base 2.7 M\n\nTransaction Summary\n================================================================================\nInstall 1 Package(s)\n\nTotal download size: 2.7 M\nInstalled size: 9.7 M\nDownloading Packages:\nRunning rpm_check_debug\nRunning Transaction Test\nTransaction Test Succeeded\nRunning Transaction\n\r Installing : 2:nmap-5.51-3.el6.x86_64 1/1 \n\r Verifying : 2:nmap-5.51-3.el6.x86_64 1/1 \n\nInstalled:\n nmap.x86_64 2:5.51-3.el6 \n\nComplete!\n"

]

}

三、playbook配置管理

A.进行一下shell模块 *** 作,测试删除文件

先查看一下客户端的server-test是否存在

[root@puppet ansible]# ansible vpn -m shell -a "ls -l /tmp/server-test" -u test --private-key=/root/denglei -k

SSH password:

172.17.0.10 | success | rc=0 >>

-rw-rw-r-- 1 test test 7 Jun 14 00:37 /tmp/server-test

然后写一个删除的playbook

[root@puppet ansible]# cat test.yml

---

- hosts: vpn

remote_user: test

tasks:

- name: delete /tmp/server-test

shell: rm -rf /tmp/server-test

[root@puppet ansible]# ansible-playbook test.yml --private-key=/root/denglei -k

[WARNING]: The version of gmp you have installed has a known issue regarding

timing vulnerabilities when used with pycrypto. If possible, you should update

it (ie. yum update gmp).

SSH password:

PLAY [vpn] ********************************************************************

GATHERING FACTS ***************************************************************

ok: [172.17.0.10]

TASK: [delete /tmp/server-test] ***********************************************

changed: [172.17.0.10]

PLAY RECAP ********************************************************************

172.17.0.10 : ok=2changed=1unreachable=0failed=0

[root@puppet ansible]# ansible vpn -m shell -a "ls -l /tmp/server-test" -u test --private-key=/root/denglei -k

SSH password:

172.17.0.10 | FAILED | rc=2 >>

ls: cannot access /tmp/server-test: No such file or directory

B.进行一下template模块 *** 作,测试文件传输

[root@puppet ansible]# cat copy.yml

---

- hosts: vpn

remote_user: test

tasks:

- name: copy local server to client /tmp/server-test

template: src=/tmp/server dest=/tmp/server-test

[root@puppet ansible]# ansible-playbook copy.yml --private-key=/root/denglei -k

[WARNING]: The version of gmp you have installed has a known issue regarding

timing vulnerabilities when used with pycrypto. If possible, you should update

it (ie. yum update gmp).

SSH password:

PLAY [vpn] ********************************************************************

GATHERING FACTS ***************************************************************

ok: [172.17.0.10]

TASK: [copy local server to client /tmp/server-test] **************************

changed: [172.17.0.10]

PLAY RECAP ********************************************************************

172.17.0.10 : ok=2changed=1unreachable=0failed=0

[root@puppet ansible]# ansible vpn -m shell -a "ls -l /tmp/server-test" -u test --private-key=/root/denglei -k

SSH password:

172.17.0.10 | success | rc=0 >>

-rw-rw-r-- 1 test test 7 Jun 14 17:07 /tmp/server-test

C.使用service模块,测试一下服务重启


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12239261.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-22
下一篇 2023-05-22

发表评论

登录后才能评论

评论列表(0条)

保存