Fastcgi 相关问题
Fastcgi ,请参考 Fastcgi 应用
access for server (uid 33, gid 33) not allowed: execute not allowed
[Thu Aug 20 08:41:08 2009] [warn] FastCGI: (dynamic) server "/root/lab/ylinux_org/ylinux.fcgi" started (pid 5274) [Thu Aug 20 08:41:10 2009] [error] [client 172.16.70.40] FastCGI: invalid (dynamic) server "/root/lab/ylinux_org/ylinux/media/home/style.css": access for server (uid 33, gid 33) not allowed: execute not allowed, referer: http://172.16.70.40/
TypeError: __init__() got an unexpected keyword argument ‘maxlength’
运行python manage.py sql jobs出现这样的错误。解决办法是:把maxlength改 为man_length就OK了
静态文件
经常我们需要显示静态文件,比如图片、css文件等等。我们需要在 urls.py 中 设置这些文件目录为静态设置。举例,比如我们的html中有下面一条css样式设置:
<link href="/ylinux/media/home/style.css" rel="stylesheet" type="text/css" />
方法1:修改 urls.py 设置
我们要确保web服务的根目录下有这个文件 "./ylinux/media/home/style.css" ,然后在 urls.py 中这样设置:
urlpatterns = patterns('',
...
(r'^ylinux/media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': os.path.dirname(os.path.abspath(__file__)) + '/ylinux/media/',
#'show_indexes': True
}),
...
)
这样我们在访问这个页面就可以看到下面web日志:
[26/Aug/2009 13:50:27] "GET / HTTP/1.1" 200 2220 [26/Aug/2009 13:50:27] "GET /ylinux/media/home/style.css HTTP/1.1" 304 0 [26/Aug/2009 13:50:27] "GET /ylinux/media/home/cur.gif HTTP/1.1" 304 0 [26/Aug/2009 13:50:27] "GET /ylinux/media/home/bg.gif HTTP/1.1" 304 0
可以看出,显示 "GET" 到 style.css 了!
方法2: 使用 web 服务器配置
比如我使用 .htaccess 文件控制:
... #静态文件 RewriteBase / RewriteRule ^ylinux/media.*$ - [L] RewriteRule ^errorpages/.*$ - [L] ...
