学习文章:http://blog.csdn.net/thinkinside/article/details/7224747
在学习这个教程的时候,有代码如下:
class ProductForm(forms.ModelForm): class Meta: model = Product # exclude = [] # uncomment this line and specify any field to exclude it ..
折腾了一个晚上,查了好多文章,都没有用。最后拼拼凑凑,总算是可以了。以下总结方法:
vim mysite/settings.py 加入: HERE = os.path.dirname(os.path.dirname(__file__)) 修改: MEDIA_ROOT = os.path.join( HERE ,'media').replace('\\','/') MEDIA_URL = '/media/' STATIC_ROOT = os.path.join(HERE,'static').replace('\\','/') STATIC_URL = '/static/' STATICFILES_DIRS = ..
安装apr
vim configure
删除: $RM ‘$cfgfile’
./configure --prefix=/home/yeelone/usr
make && make install
安装apr-utils
./configure --prefix=/home/yeelone/usr --with-apr=/home/yeelone/usr/bin/apr-1-config
make && make install
安装pcre
(确认gcc-c++有安装 ubuntu : apt-get install g++)
./configure --prefix=/home/yeelone/usr/pcre
安装apache
./configure --prefix=/home/yeelone/usr/apahce2 --with-apr=/home/yeelone/usr/..
因工作量太大,所以写了一个脚本完成自动化工作。工作内容是,在crontab中内容如下:
*/1 * * * * /home/nagios/nsca/nagios_check_ping.sh 192.168.1.1 >/dev/null 2>&1
现在改为
*/1 * * * * /home/nagios/nsca/nagios_check_ping.sh 192.168.1.1 mobile >/dev/null 2>&1
要完成自动插入mobile的工作,crontab 的条目太多,不可能手工去插入。所以我的代码如下:
#!/usr/bin/perl&nbs..
这两天在学习varnish,在学到vcl时,不理解pipe和pass的区别以及如何区分加以应用。通过两天的搜索,总算是理清了概念。现在记录在博客上跟大家分享。
当 vcl_recv 函数接收到请求时,它要判断如何处理这个请求。有三种情况 :
调用 pass 函数,从后端服务器调用数据。 调用 pipe 函数,建立客户端和后端服务器之间的直接连接,从后端服务器调用数据。 调用lookup函数,从缓存中查找应答数据并返回,如果查找不到,则调用pass函数从后端服务器调用数据 。&nbs..
为完成老大的要求,我写了一个代码完成这个工作。现在记录在博客上,跟大家分享一下。脚本水平很差,((o(´∀`)o))。
要求如下:
1、数据库mydata1中有个sms_info表,表中记录格式如下:
+-----------+------------------+------+----- | Field | +-----------+------------------+------+----- | id | 12345 &n..
因为要学习nginx的性能优化,在网上搜到了"利用TCMalloc优化nginx的性能"和“使用google-perftool优化nginx的性能”的文章。分别看了这些文章,发现是一样的内容。
其实,google-perftools包含四个工具,分别是:TCMalloc、heap-checker、heap-profiler和cpu-profiler,TCMalloc是google-perftools的其中一个工具,用于优化内存分配的效率和速度,帮助在高并发的情况下很好的控制内存的使用。
在mysql 和nginx 性能优化方案中,大多数教程都是使用..
使用nginx配置防盗链,有两种途径,一种是通过自身所提供的功能,一种是通过第三方提供的模块。
自身所提供的功能配置方法如下:
location / { root /data/download/; valid_referers none blocked server_names *.com ; if ($invalid_referer) {return 403;} }
location ~ .*\.(gif|jpg|jpeg|png|bmp|wma|mp3|swf)$ { &nb..
nginx有一个模块 StubStatus,可以提供监控nginx的当前状态的功能,它能够获取nginx自上次启动以来的工作状态。这个模块需要在安装的时候手工指定相关参数。命令如下:
./configure --with-http_stub_status_module
配置方法如下:
location /nginxstatus { stub_status on; &nb..