<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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>Comments for arteme.fi</title>
	<atom:link href="http://www.arteme.fi/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.arteme.fi</link>
	<description>python, web programming and all things unrelated</description>
	<lastBuildDate>Wed, 12 May 2010 21:23:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Rendering an SVG to a GTK image by Jairus</title>
		<link>http://www.arteme.fi/2007/03/26/rendering-an-svg-to-a-gtk-image/comment-page-1/#comment-37</link>
		<dc:creator>Jairus</dc:creator>
		<pubDate>Wed, 12 May 2010 21:23:49 +0000</pubDate>
		<guid isPermaLink="false">http://g5.arteme.fi/wordpress/?p=25#comment-37</guid>
		<description>Thanks, worked great!</description>
		<content:encoded><![CDATA[<p>Thanks, worked great!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Django CherryPy Development Server and Serving Static Files by Vlada Macek</title>
		<link>http://www.arteme.fi/2009/02/26/django-cherrypy-dev-server-and-static-files/comment-page-1/#comment-11</link>
		<dc:creator>Vlada Macek</dc:creator>
		<pubDate>Tue, 29 Sep 2009 12:42:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.arteme.fi/?p=91#comment-11</guid>
		<description>You&#039;re handing the static files by

&lt;pre&gt;
               output = [fp.read()]
               fp.close()
&lt;/pre&gt;

which causes entire content is loaded to the memory (and not only once
by my observation). This is unacceptable for large files. I found this
to be much more memory &amp; CPU efficient:

&lt;pre&gt;
   class BlockIterator(object):
       def __init__(self, fp):
           self.fp = fp

       def __iter__(self):
           return self

       def next(self):
           chunk = self.fp.read(20*1024)
           if chunk:
               return chunk
           self.fp.close()
           raise StopIteration

   ...
               output = BlockIterator(fp)
&lt;/pre&gt;

The iterator spits the content by 20KiB blocks to the network socket and
closes the file at EOF.</description>
		<content:encoded><![CDATA[<p>You&#8217;re handing the static files by</p>
<pre>
               output = [fp.read()]
               fp.close()
</pre>
<p>which causes entire content is loaded to the memory (and not only once<br />
by my observation). This is unacceptable for large files. I found this<br />
to be much more memory &#038; CPU efficient:</p>
<pre>
   class BlockIterator(object):
       def __init__(self, fp):
           self.fp = fp

       def __iter__(self):
           return self

       def next(self):
           chunk = self.fp.read(20*1024)
           if chunk:
               return chunk
           self.fp.close()
           raise StopIteration

   ...
               output = BlockIterator(fp)
</pre>
<p>The iterator spits the content by 20KiB blocks to the network socket and<br />
closes the file at EOF.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Django CherryPy Development Server and Serving Static Files by Tony</title>
		<link>http://www.arteme.fi/2009/02/26/django-cherrypy-dev-server-and-static-files/comment-page-1/#comment-10</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Wed, 25 Mar 2009 17:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.arteme.fi/?p=91#comment-10</guid>
		<description>This runs very nicely indeed. It doesn&#039;t respond to changes in the code (views, models) etc, which I guess is to be expected as its designed? for production?

I have servers that are using Apache/mod_wsgi and &#039;startup.wsgi&#039; scripts that essentially look like this:

&lt;pre&gt;
#!/usr/bin/python
import os, sys
sys.path.append(&#039;/export/home/users/djangoprojects/OurSite&#039;)
sys.path.append(&#039;/export/home/users/djangoprojects&#039;)
os.environ[&#039;DJANGO_SETTINGS_MODULE&#039;] = &#039;OurSite.settings&#039;
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
&lt;/pre&gt;

I don&#039;t know enough about CherryPy? to make comparisons, but could this method replace the startup.wsgi code cleanly? I&#039;m thinking about ease of deployment here.

Cheers, Tone</description>
		<content:encoded><![CDATA[<p>This runs very nicely indeed. It doesn&#8217;t respond to changes in the code (views, models) etc, which I guess is to be expected as its designed? for production?</p>
<p>I have servers that are using Apache/mod_wsgi and &#8217;startup.wsgi&#8217; scripts that essentially look like this:</p>
<pre>
#!/usr/bin/python
import os, sys
sys.path.append('/export/home/users/djangoprojects/OurSite')
sys.path.append('/export/home/users/djangoprojects')
os.environ['DJANGO_SETTINGS_MODULE'] = 'OurSite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
</pre>
<p>I don&#8217;t know enough about CherryPy? to make comparisons, but could this method replace the startup.wsgi code cleanly? I&#8217;m thinking about ease of deployment here.</p>
<p>Cheers, Tone</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Django CherryPy Development Server and Serving Static Files by arteme</title>
		<link>http://www.arteme.fi/2009/02/26/django-cherrypy-dev-server-and-static-files/comment-page-1/#comment-9</link>
		<dc:creator>arteme</dc:creator>
		<pubDate>Fri, 13 Mar 2009 06:21:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.arteme.fi/?p=91#comment-9</guid>
		<description>@greg: I guess that depends on what you mean by &quot;moderate traffic&quot;. I would use this in a production system as a pain-free deployment option. It surely outperforms the default dev server option ;)

At least, according to some comments at http://www.eflorenzano.com/blog/post/hosting-django-site-pure-python/, CherryPy is the tool for the job.</description>
		<content:encoded><![CDATA[<p>@greg: I guess that depends on what you mean by &#8220;moderate traffic&#8221;. I would use this in a production system as a pain-free deployment option. It surely outperforms the default dev server option ;)</p>
<p>At least, according to some comments at <a href="http://www.eflorenzano.com/blog/post/hosting-django-site-pure-python/" rel="nofollow">http://www.eflorenzano.com/blog/post/hosting-django-site-pure-python/</a>, CherryPy is the tool for the job.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Django CherryPy Development Server and Serving Static Files by greg</title>
		<link>http://www.arteme.fi/2009/02/26/django-cherrypy-dev-server-and-static-files/comment-page-1/#comment-8</link>
		<dc:creator>greg</dc:creator>
		<pubDate>Mon, 09 Mar 2009 12:32:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.arteme.fi/?p=91#comment-8</guid>
		<description>Thanks for documenting this. Could this setup be appropriate for a moderate-traffic production site?</description>
		<content:encoded><![CDATA[<p>Thanks for documenting this. Could this setup be appropriate for a moderate-traffic production site?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Django CherryPy Development Server and Serving Static Files by ScW</title>
		<link>http://www.arteme.fi/2009/02/26/django-cherrypy-dev-server-and-static-files/comment-page-1/#comment-7</link>
		<dc:creator>ScW</dc:creator>
		<pubDate>Wed, 27 Feb 2008 16:47:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.arteme.fi/?p=91#comment-7</guid>
		<description>Wow! Very nice work and thanks for the link back.</description>
		<content:encoded><![CDATA[<p>Wow! Very nice work and thanks for the link back.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
