<?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>SAE &#8211; 天地一沙鸥</title>
	<atom:link href="https://haoluobo.com/tag/sae/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>DPress部署到SAE</title>
		<link>https://haoluobo.com/2012/08/dpress-sae/</link>
					<comments>https://haoluobo.com/2012/08/dpress-sae/#comments</comments>
		
		<dc:creator><![CDATA[vicalloy]]></dc:creator>
		<pubDate>Thu, 16 Aug 2012 13:08:43 +0000</pubDate>
				<category><![CDATA[vicalloy的庄家]]></category>
		<category><![CDATA[DPress]]></category>
		<category><![CDATA[SAE]]></category>
		<guid isPermaLink="false">/?p=10695</guid>

					<description><![CDATA[将DPress部署到SAE的简要说明。如果你在部署过程中有遇到什么问题，欢迎反馈。 在SAE管理后台创建应用， [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>将DPress部署到SAE的简要说明。如果你在部署过程中有遇到什么问题，欢迎反馈。</p>



<ul class="wp-block-list"><li>在SAE管理后台创建应用，开发语言选择python</li><li>使用svn将应用代码更新到本地</li><li>修改配置文件config.yaml</li></ul>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
name: 你的应用名称
version: 1
libraries:
- name: django
  version: &quot;1.4&quot;
</pre></div>


<ul class="wp-block-list"><li>将DPress sites目录下所有文件复制到SAE应用目录(如：dpress/1/)。</li><li>在应用的根目录下创建目录libs(如：dpress/1/libs/)</li><li>将virtualenv.bundle.zip复制到libs目录
<ul>
<li>注：virtualenv.bundle.zip为python的第三方依赖包</li>
<li>下载 <a href="/wp-content/uploads/2012/08/virtualenv.bundle.zip">virtualenv.bundle</a></li>
</ul>
</li><li>在服务管理中启用mysql数据库</li><li>由于SAE上无法使用Django命令。需要在本地使用syncdb命令在本地mysql数据库中创建好DPress的初始数据，然后使用SAE的phpmyadmin将数据导入到SAE。</li><li>在服务管理中创建Storage，并将Domain设置为base</li><li>创建配置文件settings/local.py</li></ul>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
# -*- coding: UTF-8 -*-
import sae.const
DATABASES = {
    &#039;default&#039;: {
        &#039;ENGINE&#039;: &#039;django.db.backends.mysql&#039;, # Add &#039;postgresql_psycopg2&#039;, &#039;postgresql&#039;, &#039;mysql&#039;, &#039;sqlite3&#039; or &#039;oracle&#039;.
        &#039;NAME&#039;: sae.const.MYSQL_DB,                      # Or path to database file if using sqlite3.
        &#039;USER&#039;: sae.const.MYSQL_USER,                      # Not used with sqlite3.
        &#039;PASSWORD&#039;: sae.const.MYSQL_PASS,                  # Not used with sqlite3.
        &#039;HOST&#039;: sae.const.MYSQL_HOST,                      # Set to empty string for localhost. Not used with sqlite3.
        &#039;PORT&#039;: sae.const.MYSQL_PORT,                      # Set to empty string for default. Not used with sqlite3.
    }
}
DEFAULT_FILE_STORAGE = &#039;saestorage.SaeStorage&#039;
FILEBROWSER_DIRECTORY = &#039;&#039;
STATIC_URL = &#039;http://vicalloy.sinaapp.com/dpress/&#039;#修改为你静态资源位置
DPRESS_TITLE = u&#039;天地一沙鸥&#039;
DPRESS_SUBTITLE = u&#039;to be continue&#039;
DPRESS_DESCN = &#039;&#039;
DISQUS_SHORTNAME = &#039;&#039;
GOOGLE_ANALYTICS_CODE = &#039;&#039;
#根据你的静态资源位置进行修改
EPIC_JS = &#039;http://vicalloy.sinaapp.com/dpress/dpress/epiceditor/js/epiceditor.min.js&#039;
EPIC_BASEPATH = &#039;http://vicalloy.sinaapp.com/dpress/dpress/epiceditor&#039;

</pre></div>


<ul class="wp-block-list"><li>到这里服务已经可以跑起来了。由于没有对静态资源进行配置，将出现无法找到静态资源的情况。</li><li>创建一个新的SAE应用，应用类型选择PHP，专门用于管理DPress的静态资源文件（如：dstatic.sinaapp.com）。</li><li>在本地运行Django的collectestatic命令将DPress的静态资源收集到sites/collectedstatc/目录。</li><li>将collectedstatc中的内容复制到新创建的站点
<ul>
<li>如：static/dpress/。对应的STATIC_URL配置文件修改为 http://dstatic.sinaapp.com/static/dpress/</li>
</ul>
</li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://haoluobo.com/2012/08/dpress-sae/feed/</wfw:commentRss>
			<slash:comments>27</slash:comments>
		
		
			</item>
		<item>
		<title>SAE Storage for Django</title>
		<link>https://haoluobo.com/2012/08/sae-storage-for-django/</link>
		
		<dc:creator><![CDATA[vicalloy]]></dc:creator>
		<pubDate>Tue, 14 Aug 2012 13:48:19 +0000</pubDate>
				<category><![CDATA[vicalloy的庄家]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[SAE]]></category>
		<guid isPermaLink="false">/?p=10677</guid>

					<description><![CDATA[DPress 修正后想着要部署一个在线的演示程序。问题是我自己虚拟主机的资源已经捉襟见肘，于是只能打SAE的主 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="https://github.com/vicalloy/DPress">DPress</a> 修正后想着要部署一个在线的演示程序。问题是我自己虚拟主机的资源已经捉襟见肘，于是只能打SAE的主意了。<br />
为保证文件上传功能的正常使用需要将Django默认的Storage实现替换为SAE的storage实现。SAE的官方并没有提供Django的storage实现，需要自己另外实现。在<a href="https://gist.github.com/">github:gist</a>上有人贴出了SAE Storage for Django的实现(<a href="https://gist.github.com/2786290">SAE Storage for Django</a>)。github:gist上的这个SAE Storage实现有些bug，我修正后的版本见<a href="https://github.com/vicalloy/DPress/blob/master/sites/saestorage.py">saestorage</a>。<br />
<strong>注:</strong></p>
<ul>
<li>SAE Storage单节点的最大容量为2G(注：<a href="http://sae.sina.com.cn/?m=devcenter&amp;catId=204#anchor_073584c22b41f4304d06caf828795c97">SAE Storage 服务限制</a>)。这对于一些小站点来说是没什么问题，但如果是一个大型的商业站点这必然会有些不便。难道你需要配置一个storage列表，让程序自行去寻找可用的storage？</li>
<li>SAE Storage似乎不太稳定，上传的文件经常会打不开。</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>使用反向代理为SAE“绑定”顶级域名</title>
		<link>https://haoluobo.com/2012/03/domain_mod_proxy/</link>
		
		<dc:creator><![CDATA[vicalloy]]></dc:creator>
		<pubDate>Tue, 06 Mar 2012 13:08:53 +0000</pubDate>
				<category><![CDATA[编程]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mod_proxy]]></category>
		<category><![CDATA[SAE]]></category>
		<guid isPermaLink="false">/?p=10429</guid>

					<description><![CDATA[朋友的VPS服务器近期经常出现内存超标的问题。想我的SAE免费资源闲着也是闲着，于是将上面的博客迁移到SAE平 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>朋友的VPS服务器近期经常出现内存超标的问题。想我的SAE免费资源闲着也是闲着，于是将上面的博客迁移到SAE平台。<br>SAE商店中的wordpress可以免费安装使用。受SAE平台的限制，SAE版的wordpress有部分功能限制，比如可用的主题也就那么2~3款。另外一个比较大的问题是无法绑定域名。解决该问题的方法之一即是使用反向代理。<br>我的虚拟主机上用的是apache，下面是相关设置。<br><strong>httpd.conf</strong></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
</pre></div>


<p><strong>.htaccess</strong></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ http://domain.sinaapp.com/$1 &#x5B;P]
</pre></div>]]></content:encoded>
					
		
		
			</item>
		<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>收到SAE的开发者证书了</title>
		<link>https://haoluobo.com/2011/11/sae-dev-cer/</link>
					<comments>https://haoluobo.com/2011/11/sae-dev-cer/#comments</comments>
		
		<dc:creator><![CDATA[vicalloy]]></dc:creator>
		<pubDate>Mon, 21 Nov 2011 13:04:33 +0000</pubDate>
				<category><![CDATA[vicalloy的庄家]]></category>
		<category><![CDATA[SAE]]></category>
		<guid isPermaLink="false">/2011/11/%e6%94%b6%e5%88%b0sae%e7%9a%84%e5%bc%80%e5%8f%91%e8%80%85%e8%af%81%e4%b9%a6%e4%ba%86/</guid>

					<description><![CDATA[前段时间SAE开始分发python的内测名额，一时手慢，错过机会。不过倒看到SAE可以申请开发者证书。申请资格 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>前段时间SAE开始分发python的内测名额，一时手慢，错过机会。不过倒看到SAE可以申请开发者证书。申请资格中写有开源作者可以申请高级开发者证书。由于错过内测名额，所以就有啥拿啥吧。<br />
感觉SAE的这次营销策划想法非常的好。可以花很少的钱就可以做到不错的推广效果，最重要的是还能得到一个皆大欢喜的结果。<br />
PS：<br />
申请一个SAE证书还是有些好处的。申请成高级开发者后，每年可以有￥1800的免费SAE资源可以使用。<br />
<img fetchpriority="high" decoding="async" style="background-image: none; padding-left: 0px; padding-right: 0px; padding-top: 0px; border-width: 0px;" src="/wp-content/uploads/2011/11/sae.jpg" alt="" width="550" height="825" border="0" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://haoluobo.com/2011/11/sae-dev-cer/feed/</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
	</channel>
</rss>
