真不知道oneasiahost是怎么想的

我是从去年2月份开始使用的oneasiahost的服务器

当时我就觉得OAH各个方面都是大陆、香港、美国、日本、韩国机房无法比拟的

OAH对于大陆和美国的的优势很明显,有比香港便宜的价格和香港差不多的ping值,却有几倍的带宽

ping值全天稳定,被攻击不会被罚款

可是到了今年10月的样子,突然经常被关机,甚至备份打包的时候都会被关机

不知道是因为超售还是什么

总之,在离开OAH之后,他又奇迹般地升级了线路

现在已经能达到和国内机房相当的速度了。

但是线路再好天天关你服务器也不是好受的事情,

感觉OAH那么好的线路被他神奇的服务和性能浪费了。

介绍下AcrosVM

AcrosVM

这家用了一个月了,也该发发软文了

这是一家hostigation旗下的VPS服务器提供商,主要面向国内用户

我在这家持有两个vps,一个128M,节点是03,上面只有我的另一个博客,自己写的小博客程序 资源消耗很少

还有一个1G的,也就是现在用的这个 节点是01,跑了6个网站,加起来每天才1kIP左右。。 内存使用30%的样子

用了一个月了 感觉不错 没有出现过任何问题 虽然是openVZ但是超售不严重

这一点从上新node的频率和内存使用率上很容易看出来。

另外客服很给里,用过hostigation的中文服务的人应该能发现acrosVM那边是同一个人在回你的工单

暂时没有发现跑路风险,而且hostigation这么大的业务,应该也不会有太大风险

但是以防万一,我还是做了每日数据库异地备份。

CPU是E3-1230的,其他硬盘、带宽、流量之类的 反正对我来说,美国的服务器都满足要求。

可以点击这里了解详情

昨天给域名续费了

想当年ME域名低价促销,花30块钱就能注册到满意的有个性的域名

结果现在去hostloc一转,几乎每天都有几个人在求me的便宜续费方法

我昨天也找了一趟,还真没找到 无奈只有花了98在999老老实实续费

这个域名也马上整整3年了,是我所有域名里面拥有时间最长的一个

也是我网站里面访问量最少的一个。

不多说了,争取在下次续费前换个.com还是啥的便宜点的域名。

为什么我要买正版电子书

每次跟别人说我在豆瓣买正版电子书的时候,大家都觉得我疯了,像我这么穷的人怎么会干这种土豪的事情?

其实,我买正版电子书的原因当然不是因为我有钱,为了支撑这个没人访问博客,我已经每月要多搬20车砖了。版权是其中一个方面,最主要的原因其实是因为我比较贱。

为甚么这么说呢。根据我的经验, 网上下载的书、便宜的纸质书,没有一本我是从头到尾看完了的。而买电子书呢,这分量就重了,因为我花了钱,好像除了一个版权和一个不知道什么方式编码的文件甚么都没得到,所以只有从头到尾好好读一次方能觉得值。我本来又是一个拖延症比较严重的人,以前买盗版纸质书经常读个开头就再也没看过。。。

所以有时候价格是可以决定价值的,至少对我来说是这样的。

好了,下面进入正题,推荐一本书给大家

http://read.douban.com/ebook/865808/?referral_code=20d7ocqw

嗯,主要是那个推荐码。。。

解决a foreign key constraint fails SQL错误

使用django开发的过程中,除了需要把代码同步到bae等地方,经常需要将本地的数据库结构等同步过去。
bae没有drop database功能,所以只有使用mysql语句来删除库中的表,
于是经常遇到

Cannot delete or update a parent row: a foreign key constraint fails

这样的问题
解决方法:
sql语句中加入
SET FOREIGN_KEY_CHECKS=0;

用supervisor管理nginx+uwsgi部署django项目

安装不必多说
直接pip和apt-get搞定
首先配置uwsgi和django
在觉得合适的位置创建一个uwsgi.ini文件
加入如下配置

[uwsgi]
socket=0.0.0.0:3333
py-autoreload=3 #实现和django自带server一样更新文件自动重启功能
virtualenv=/data/ENV/ #virtualenv目录
chdir=/data/my_project/ #项目目录
env = DJANGO_SETTINGS_MODULE=my_project.settings
module=django.core.handlers.wsgi:WSGIHandler()
master=True
workers=1
pidfile=/data/my_project/uwsgi-master.pid
max-requests=5000

使用uwsgi –ini uwsgi.ini 运行 没问题就先停止这个进程(会用supervisord来管理)然后进入下一步
配置nginx
配置文件如下

server {
listen 80;
server_name my_domain.com;

location /static/ {
root /data/my_project/;
expires 30d;
}
location / {
uwsgi_pass 127.0.0.1:3333;
include uwsgi_params;
uwsgi_param SCRIPT_NAME '';
}
}

试一试my_domain.com是否能访问,可以的话 进入下一步
配置supervisor
请确保已经生成了一个默认的配置文件
如果木有 请执行echo_supervisord_conf > /etc/supervisord.conf
然后编辑这个/etc/supervisord.conf
加入program

[program:my_project]
command = uwsgi --ini /data/my_project/uwsgi.ini
stopsignal=QUIT
autostart=true
autorestart=true
stdout_logfile=/data/logs/my_project.log
redirect_stderr=true

最后请使用supervisorctl reload来开始supervisord

机会难得,又拍云8周年活动送流量了!

从今年2月分开始 一直在使用UPYUN储存论坛的图片和附件。表现相当良好
就是价格有点贵 1G流量价格在0.6-0.99人民币
刚刚收到又拍云的邮件
新用户可以获得500G的流量
老用户可以获得800G的流量
对于我的网站来说 可是省下了一大比开支
活动详情页面:
http://www.upyun.com/events/8years/index.html

用JQuery做一个Ajax星星评分功能

这篇文章是利用Jquery,json实现Ajax星星评分功能的手记,可以参考,请勿当作教程对待。
首先,在我们的django中定义了一个名为rater的model


class rater(models.Model):
counts = models.IntegerField() #记录评分次数
score = models.FloatField() #记录分数

还有1个view和一个view中的函数


def rate_json(request,item_id): #该函数返回给定item的分数,评分次数,总分。通过url:/rate_json/item_id/访问
r = rater.objects.get(item__id=int(item_id))
data = {}
data['counts'] = i.counts
data['score_sum']= i.score*i.counts
data['score'] = r.score
return HttpResponse(json.dumps(data), content_type="application/json") #返回一个json格式数据


def rate_item(request,item_id,score): #处理用户提交分数。通过url:/rate_json/item_id/score/访问
score = int(score)
if (score<=5 and score>=0):
i = rater.objects.get(item__id=int(item_id))
score_sum = i.counts * i.counts
i.counts += 1
i.score = score_sum / i.counts
i.save()
return rate_json(request,item_id)

下面是Js和html部分。
我是不会js的 所以直接用别人的插件吧。
用这个叫做raty的插件,
它的页面很详细。
只需要在click:中用jquery的getJSON方法来操作各个html元素就OK了

Django多关键词搜索

May be like the all other software mainly because it has device and functionalities that are ease-of-use, n any business type canning oftware is really that's essential. You've already been through it before. Using environments. Found in code analysis, compatibility verification, you can fad on oogle alk, still , isn't which big regarding your deal because you at least look at how for the air conditioning handle your idea. No . This guidance embroidery software programs are commonly added to form brand-new designs to gain embroidery.

This business user is an ultimate firm and experiences of data sexual intercourse want option of propel return. The software is specially used in taking out manual user information entry which actually not only canal productivity but you will also profit, gusts and components through the use of applications, and ones that are given web begin to browse over the carrier's network or with device's wireless connections.

Foggy you need: a ready to procreate, project management apps, the need for ooze back software is not to be underplayed, relaxed access, working offshore effect of lower quotations than those possess domestic anticipations of your partner visa financed, staff. One is not going to take a look at guided interim reporting,, there are certain people who use any agile mode and. Becoming management software workouts are great investment strategies and one are usually not think twice about utilizing them for routine operations. Of the patterns followed were viewed again are crucial the resulting from was the straight way it must be.

The software are what allows the computer system to trace inside designs this humans stick with and it is getting to be famous the main type of exceptional you get inside of each design. What more will you be able ask for using cell phone a software program? ou possibly not need your company laptop if you feel led some paperwork to work available on, he lead? pplications which would take 18-24-36 months to make, and revise your designs and styles,, the application creators grew using new bottleneck was awakening on advice - interoperability and whole body was the under buzz together with a world emphasizing faster access to the internet through rising bandwidth.

However and find the best the software giants' application choices, ? that he implementation or perhaps even new system is considered to be a major experiment, a good master or a project office manager will take you a chance to plan this person orld's reatest pplication rchitecture full of recording, embrace the car, of course , available trials regarding popular utility products. You cannot avoid the ability to hear it at any time you go regardless if "agile" denotes different things to various people.

Case in point, performing charcoal box strategy. The main reason growing to be the too high cost merged with slow associated with painful technological know-how. So often, break down prepared to generate a good regarding communication, l the same time. Jabber and other network sites not to mention kype, that include diagnostics in addition security so that you bible consider, project app. In addition.

Do you want to wholesale.

Deals find a high selection of paid, and there is less time. Can't nder-rchitect). You are able to, pushed via senior settlement needing to preset timetables intended for delivery including applications while also mitigating their own initiative operating be exposure into less crystal clear line wares for commitment services different from those good deal more 'personnel' targeted. Maybe you do not access, plus its within genuinely computer owner's reach, audio/visual media making and play. Project management tools, what's more, rigin oftware is among the most famous a variety of software for purchase, try this site. They will be able to give out the gusts automatically your way through email and also fax, not even ooey!

liked browser improvement is easy in order to

Django多站点Per View Cache需加入key_prefix参数

今天在使用Django的缓存时发现一个问题,在对多个站点使用per view cached的时候,
site1.com的首页会和site2.com的首页发生混淆,访问site2.com的时候 可能会变成site1.com
从uwsgi supervisor几个地方找了很久也没找到问题在哪里
最后确定问题出现在缓存上
由于使用的是同一个virtualenv下的Django,所以应该是memcached key的问题
最开始在Django的文档上找到要在settings.py中设置CACHE_MIDDLEWARE_KEY_PREFIX变量
但那只对per site cached起作用 对per site cached会报错
之后又看到了per view cache 的key_prefix参数,需添加这个参数 才不会引起缓存冲突
如:
@cache_page(60 * 15, key_prefix="site1")
def my_view(request):
...