<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jstnote &#8211; 天地一沙鸥</title>
	<atom:link href="https://haoluobo.com/tag/jstnote/feed/" rel="self" type="application/rss+xml" />
	<link>https://haoluobo.com</link>
	<description>to be continue....</description>
	<lastBuildDate>Thu, 16 Dec 2021 03:37:13 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>SAE部署Django1.3应用问题总汇</title>
		<link>https://haoluobo.com/2012/02/sae-django1-3/</link>
		
		<dc:creator><![CDATA[vicalloy]]></dc:creator>
		<pubDate>Tue, 28 Feb 2012 12:13:03 +0000</pubDate>
				<category><![CDATA[编程]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[jstnote]]></category>
		<category><![CDATA[SAE]]></category>
		<guid isPermaLink="false">/?p=10421</guid>

					<description><![CDATA[花了些工夫将碎片网部署到了SAE，中途遇到各类问题。感觉SAE看上去很美，实际上却并不是太成熟（至少pytho [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>花了些工夫将<a href="http://qnotes.sinaapp.com">碎片网</a>部署到了SAE，中途遇到各类问题。感觉SAE看上去很美，实际上却并不是太成熟（至少python版如此）。<br>下面记录下我遇到的一些主要问题以及解决方法。</p>



<h3 class="wp-block-heading">django版本问题</h3>



<p>Django1.4都即将发布了，SAE平台自带的SAE版本依旧为1.2x。为使用django1.3版本，你需上传自己的django。具体做法可参考SAE手册中的<a href="http://appstack.sinaapp.com/static/doc/release/testing/runtime.html#virtualenv">runtime.html#virtualenv</a></p>



<h3 class="wp-block-heading">日志模块出错</h3>



<p>最先遇到的是日至模块的问题。错误显示<strong>AdminEmailHandler</strong>中构造某个类时带了is_mail这个参数，但目标类的构造函数根本就不支持。好在日至模块不是必须。将日至处理模块换成<strong>django.utils.log.NullHandler</strong>解决问题。</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&#039;null’: { &#039;level’:&#039;DEBUG’, &#039;class’:&#039;django.utils.log.NullHandler’, },
</pre></div>


<h3 class="wp-block-heading">local_thread问题</h3>



<p>在index.wsgi中加入</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
import threading
from django.utils import _threading_local
threading.local = _threading_local.local
</pre></div>


<h3 class="wp-block-heading">settings文件</h3>



<p>SAE默认安装了不少python包，其中包括django-userena。糟糕的是SAE将django-userena的demo项目也加到了python路径，而且加载的优先级比项目代码还高。直接导致<strong>os.environ[&#8216;DJANGO_SETTINGS_MODULE&#8217;] = &#8216;settings&#8217;</strong>找到的是userena的settings文件。最终将settings文件改名为<strong>qnotes_settings.py</strong>解决该问题。</p>



<h3 class="wp-block-heading">其他问题</h3>



<ul class="wp-block-list"><li>昨天部署上线后经常出现数据库错误，错误提示为Caught OperationalError while rendering: (1045, &#8216;access deny&#8217;)&nbsp; 。SAE数据库不支持长连接，30s后主动超时。但django本就会在每次请求后自动关闭数据库连接，理论上不应当出现类似问题。该问题今天莫名其妙的自己好了。</li><li>服务器非常不稳定，经常长时间的无法访问，不定期的可以正常访问。</li><li>SAE可能hack了python的包加载机制的原因，SAE的python包的加载行为有些奇怪。本应当最先加载当前目录下的包，实际上却不一定。</li></ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>又挖了一个新坑-_-，文本分享网站</title>
		<link>https://haoluobo.com/2012/02/share-tx/</link>
		
		<dc:creator><![CDATA[vicalloy]]></dc:creator>
		<pubDate>Sun, 26 Feb 2012 13:15:47 +0000</pubDate>
				<category><![CDATA[vicalloy的庄家]]></category>
		<category><![CDATA[jstnote]]></category>
		<guid isPermaLink="false">/?p=10375</guid>

					<description><![CDATA[网站 http://qnotes.sinaapp.com 代码 https://github.com/vica [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>网站 <a href="http://qnotes.sinaapp.com">http://qnotes.sinaapp.com</a><br />
代码 <a href="https://github.com/vicalloy/jstnote">https://github.com/vicalloy/jstnote</a><br />
类似 <a href="http://dpaste.com/">http://dpaste.com/</a> 的文本分享工具。<br />
dpaste.com 用来贴代码，这个用来分享一般文档。<br />
支持TXT, Html, Markdown, Textile, reStructuredText格式。<br />
匿名使用，在保存文本的时候设置编辑密码，凭编辑密码对文本进行编辑删除(密码暂时还不可修改-_-)。<br />
罪魁祸首是我想随便写个小东西放到SAE上，把SAE的免费配额用掉点。<br />
最开始只是想做个最简单的在线标记语言标记分享工具，预计花1~2天时间做到 http://dpaste.com/ 的程度。<br />
接着&#8230;<br />
考虑到使用的方便性，取消了注册功能。<br />
因为是文档写作工具，所以编辑功能是需要的。<br />
后来想评论功能得加上。<br />
然后想加上评论功能后就是一个类似百度贴吧的匿名社区了，那不如把tag也加上。<br />
最终就成了现在的样子。<br />
因为功能一直加，时间也远超预期（好在没拖到下周）。<br />
UI用的twitter-bootstrap。<br />
使用的django框架加若干第三方APP<br />
代码放在<br />
<a href="https://github.com/vicalloy/jstnote"> https://github.com/vicalloy/jstnote</a><br />
写代码的时候只考虑到工作量，有现成的组件尽量用现成的，性能应当会非常的差。<br />
吐槽：<br />
&#8211; django自带的评论app非常的不人性化。为了防止进入评论的错误提示页面，花了不少时间用JS写表单的错误检验。<br />
&#8211; SAE不是太好用。默认带的django太老。使用自己的django，一直出错。尝试解决了几个问题后最终放弃。（注：已经成功部署上去，感觉问题不少，还有待验证）</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
