This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
// ajax提交一个form表单的内容的插件 | |
$.fn.extend( | |
{ | |
Submit:function(callback){ | |
$(this).each(function(i){ | |
var form = $(this); | |
var params = {}; | |
var url = form.attr("action"); | |
console.log(url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxies = {} | |
class _DbWrapper(): | |
def __init__(self,module): | |
self.connection=None #这个就是维护的长连接对象 | |
self.db=module #这个是被包装的原生MySQLdb的module | |
def __getattr__(self, key): | |
return getattr(self.db, key) #代理所有不关心的函数 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import MySQLdb as Database | |
Database = pool.manage(Database) | |
except ImportError, e: | |
from django.core.exceptions import ImproperlyConfigured | |
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxies = {} | |
class _ConnectionWrapper(object): | |
""" | |
用来包装Connection的类 | |
""" | |
def __init__(self,conn): | |
self.conn=conn | |
def close(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
proxies = {} | |
class _ConnectionWrapper(object): | |
def __init__(self,conn): | |
self.conn=conn | |
def close(self): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
proxies = {} | |
class _ConnectionWrapper(object): | |
def __init__(self,conn): | |
self.conn=conn | |
def close(self): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Blog(DynamicBase): | |
title=Column(unicode,max_length=200) | |
content=Column(unicode) | |
post_date=Column(datetime.datetime,db_index=True) | |
auther=FkColumn(User) | |
class Meta: | |
table_name="blogs" | |
connection=connections[DB] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//数据表 blogs: | |
CREATE TABLE `blogs` ( | |
`id` int(11) NOT NULL, | |
`object` varbinary(20000) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
//同时建立两个索引表 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'alexander' | |
import os | |
import sys | |
from tornado.options import options, define, parse_command_line | |
import django.core.handlers.wsgi | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.web | |
import tornado.wsgi | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:web] | |
command=python /var/www/site/Serv.py 80%(process_num)02d | |
process_name=%(program_name)s_%(process_num)02d | |
umask=022 | |
startsecs=0 | |
stopwaitsecs=0 | |
redirect_stderr=true | |
stdout_logfile=/tmp/codoon.log | |
numprocs=4 | |
numprocs_start=1 |