<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>一个程序猿 &#187; django</title>
	<atom:link href="http://www.sunboyu.cn/tag/django/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sunboyu.cn</link>
	<description>时光不会倒流,脚步总要前进</description>
	<pubDate>Tue, 31 Jan 2012 10:50:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>django+nginx的部分配置</title>
		<link>http://www.sunboyu.cn/2009/12/16/djangonginx%e7%9a%84%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/16/djangonginx%e7%9a%84%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae.shtml#comments</comments>
		<pubDate>Wed, 16 Dec 2009 03:26:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1097</guid>
		<description><![CDATA[nginx的配置，特别感谢爱词霸的吕同学，发扬了开源共享的精神，大大缩短了我的调试成本。
server {
&#160;&#160; &#160;listen 80;
&#160;&#160; &#160;server_name python.sunboyu.cn;
&#160;&#160; &#160;location / {
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_pass 127.0.0.1:8000;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_buffers&#160; &#160; &#160; 16&#160; 128k;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_ignore_client_abort&#160; on;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_read_timeout 60;
&#160;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_param PATH_INFO $fastcgi_script_name;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_param REQUEST_METHOD $request_method;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_param QUERY_STRING $query_string;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_param CONTENT_TYPE [...]]]></description>
			<content:encoded><![CDATA[<p>nginx的配置，特别感谢<a href='http://www.iciba.com/' target='_blank'>爱词霸</a>的<a href='http://blog.lvscar.info/' target='_blank'>吕同学</a>，发扬了开源共享的精神，大大缩短了我的调试成本。</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">server {</li>
<li>&nbsp;&nbsp; &nbsp;listen 80;</li>
<li>&nbsp;&nbsp; &nbsp;server_name python.sunboyu.cn;</li>
<li>&nbsp;&nbsp; &nbsp;location / {</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_pass 127.0.0.1:8000;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_buffers&nbsp; &nbsp; &nbsp; 16&nbsp; 128k;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_ignore_client_abort&nbsp; on;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_read_timeout 60;</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param PATH_INFO $fastcgi_script_name;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param REQUEST_METHOD $request_method;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param QUERY_STRING $query_string;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param CONTENT_TYPE $content_type;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param CONTENT_LENGTH $content_length;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param SERVER_PROTOCOL&nbsp; $server_protocol;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param SERVER_PORT&nbsp; &nbsp; &nbsp; $server_port;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param SERVER_NAME&nbsp; $server_name;</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_pass_header Authorization;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_intercept_errors off;</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>}</li></ol></div>
<p>同时附上一个额外的文档，nginx变量跟cgi协议的对应关系。<br />
注：在配置中，并不是所有的变量必须加上，而是根据环境选择其中应该有的变量，至于具体加哪些变量，得求助高人了。</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">#&nbsp; &nbsp; Fast CGI param reference</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SCRIPT_FILENAME&nbsp; $document_root$fastcgi_script_name;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; QUERY_STRING&nbsp; $query_string;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; REQUEST_METHOD&nbsp; $request_method;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; CONTENT_TYPE&nbsp; $content_type;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; CONTENT_LENGTH&nbsp; $content_length;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; GATEWAY_INTERFACE&nbsp; CGI/1.1;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_SOFTWARE&nbsp; nginx;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SCRIPT_NAME&nbsp; $fastcgi_script_name;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; REQUEST_URI&nbsp; $request_uri;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; DOCUMENT_URI&nbsp; $document_uri;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; DOCUMENT_ROOT&nbsp; $document_root;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_PROTOCOL&nbsp; $server_protocol;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; REMOTE_ADDR&nbsp; $remote_addr;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; REMOTE_PORT&nbsp; $remote_port;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_ADDR&nbsp; $server_addr;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_PORT&nbsp; $server_port;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_NAME&nbsp; $server_name;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/16/djangonginx%e7%9a%84%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django笔记3-DEMO篇</title>
		<link>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b03-demo%e7%af%87.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b03-demo%e7%af%87.shtml#comments</comments>
		<pubDate>Tue, 15 Dec 2009 13:06:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[demo]]></category>

		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1089</guid>
		<description><![CDATA[1、创建一个project（可理解为站点）
django-admin.py startproject project1
发现新建了一个文件夹 project1
2、创建一个app（可理解为一个……）
python manage.py app1
发现多了一个文件夹 app1
3 、vi ./app1/views.py  增加代码
from django.http import HttpResponse
def index(self,request):
&#160;&#160; &#160;return HttpResponse('hello test')
4、vi ./urls.py  增加代码
( r&#8217;^tests/&#8217; , &#8216;project1.app1.views.index&#8217; ),
5、启动服务
python manage.py runserver domain.com:8000
然后在浏览器打 domain.com:8000/tests
如果能看到 hello test则证明配置成功。
如果不成功，看debug信息吧，debug默认是开启的。
另外我自己配置使用fastcgi方式运行python，python manage.py runfcgi host=127.0.0.1 port=8000,然后用nginx代理访问。两种方式还有所不同，具体的不同点暂时还不知道，希望知道这些差别的大大们多加提示，继续研究中。
]]></description>
			<content:encoded><![CDATA[<p>1、创建一个project（可理解为站点）</p>
<p>django-admin.py startproject project1</p>
<p>发现新建了一个文件夹 project1</p>
<p>2、创建一个app（可理解为一个……）</p>
<p>python manage.py app1</p>
<p>发现多了一个文件夹 app1</p>
<p>3 、vi ./app1/views.py  增加代码</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">from django.http import HttpResponse</li>
<li>def index(self,request):</li>
<li>&nbsp;&nbsp; &nbsp;return HttpResponse('hello test')</li></ol></div>
<p>4、vi ./urls.py  增加代码<br />
( r&#8217;^tests/&#8217; , &#8216;project1.app1.views.index&#8217; ),</p>
<p>5、启动服务</p>
<p>python manage.py runserver domain.com:8000</p>
<p>然后在浏览器打 domain.com:8000/tests</p>
<p>如果能看到 hello test则证明配置成功。</p>
<p>如果不成功，看debug信息吧，debug默认是开启的。</p>
<blockquote><p>另外我自己配置使用fastcgi方式运行python，python manage.py runfcgi host=127.0.0.1 port=8000,然后用nginx代理访问。两种方式还有所不同，具体的不同点暂时还不知道，希望知道这些差别的大大们多加提示，继续研究中。</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b03-demo%e7%af%87.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django笔记1-安装篇</title>
		<link>http://www.sunboyu.cn/2009/12/14/django%e7%ac%94%e8%ae%b01-%e5%ae%89%e8%a3%85%e7%af%87.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/14/django%e7%ac%94%e8%ae%b01-%e5%ae%89%e8%a3%85%e7%af%87.shtml#comments</comments>
		<pubDate>Mon, 14 Dec 2009 11:02:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1082</guid>
		<description><![CDATA[1、安装django，当然要安装python，我安装的python2.5
./configure &#8211;prefix=你的路径
2、安装mysqldb
这个可以看这篇文章 http://www.sunboyu.cn/2009/04/22/python25mysqldb122%E5%AE%89%E8%A3%85.shtml
3、安装easl_install
http://pypi.python.org/pypi/setuptools  我下的源码，按照提示安装就行
4、使用easl_install安装flup
地址 http://www.saddi.com/software/flup/dist/flup-1.0.2-py2.5.egg
5、安装django1.1
python setup install
到这里大体就算安装完了，底下配置。
]]></description>
			<content:encoded><![CDATA[<p>1、安装django，当然要安装python，我安装的python2.5</p>
<p>./configure &#8211;prefix=你的路径</p>
<p>2、安装mysqldb</p>
<p>这个可以看这篇文章 http://www.sunboyu.cn/2009/04/22/python25mysqldb122%E5%AE%89%E8%A3%85.shtml</p>
<p>3、安装easl_install</p>
<p>http://pypi.python.org/pypi/setuptools  我下的源码，按照提示安装就行</p>
<p>4、使用easl_install安装flup</p>
<p>地址 http://www.saddi.com/software/flup/dist/flup-1.0.2-py2.5.egg</p>
<p>5、安装django1.1</p>
<p>python setup install</p>
<p>到这里大体就算安装完了，底下配置。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/14/django%e7%ac%94%e8%ae%b01-%e5%ae%89%e8%a3%85%e7%af%87.shtml/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

