寻觅生命中的那一片浅草......

发布者 夜行人

zz:SSL工作流程,握手过程

讲得比较详细,清晰
点击:

SSL工作流程,握手过程

zz:网页版ssh终端

网页版ssh终端

zz:Selenium+Phantomjs数据抓取环境配置

直接发个地址,就不复制粘贴了
数据抓取的艺术(一):Selenium+Phantomjs数据抓取环境配置

func在openSUSE12.3上的问题

同样的程序,在CentOS上可以正常执行

func “*” ping

但在openSUSE上就有问题,经过调试发现,openSUSE下,site-packages有2个路径

通过下面的命令获取的是

import distutils.sysconfig
distutils.sysconfig.get_python_lib()
‘/usr/lib/python2.7/site-packages’

但func实际安装在

/usr/local/lib/python2.7/site-packages/func

需要修改代码:

vi /usr/local/lib/python2.7/site-packages/func/module_loader.py

module_file_path = “%s/%s” % (python_path, path)

下添加

if not os.path.isdir(module_file_path):
    python_path = ‘/usr/local/lib/python2.7/site-packages’
    module_file_path = “%s/%s” % (python_path, path)

访问Django的admin报TemplateDoesNotExist解决办法

环境是Django+uwsgi+Nginx

在浏览器访问http://localhost/admin,报下面的错误,这个错误虽然不影响正常访问,但在调试程序的时候,动不动来一坨这玩意,是比较恶心的

Traceback (most recent call last):
File “/opt/dj1.4/lib/python2.7/site-packages/django/core/handlers/wsgi.py”, line 241, in __call__
response = self.get_response(request)
File “/opt/dj1.4/lib/python2.7/site-packages/django/core/handlers/base.py”, line 153, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File “/opt/dj1.4/lib/python2.7/site-packages/django/core/handlers/base.py”, line 228, in handle_uncaught_exception
return callback(request, **param_dict)
File “/opt/dj1.4/lib/python2.7/site-packages/django/utils/decorators.py”, line 91, in _wrapped_view
response = view_func(request, *args, **kwargs)
File “/opt/dj1.4/lib/python2.7/site-packages/django/views/defaults.py”, line 32, in server_error
t = loader.get_template(template_name) # You need to create a 500.html template.
File “/opt/dj1.4/lib/python2.7/site-packages/django/template/loader.py”, line 145, in get_template
template, origin = find_template(template_name)
File “/opt/dj1.4/lib/python2.7/site-packages/django/template/loader.py”, line 138, in find_template
raise TemplateDoesNotExist(name)
django.template.base.TemplateDoesNotExist: 500.html

打开nginx的error_log

error_log /data/logs/admin_error_log;

可以看到

2013/03/05 17:19:17 [error] 1722#0: *1091930 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.10, server:localhost, request: “GET /favicon.ico HTTP/1.1”, upstream: “uwsgi://127.0.0.1:8000”, host: “localhost”

浏览器请求favicon.ico,但Django没有,所以报错了,我们可以在Nginx添加配置解决这个问题

location /favicon.ico {
empty_gif;
break;
}

2025年七月
« 5月    
 123456
78910111213
14151617181920
21222324252627
28293031