随笔分类 -  Linux

摘要:先说说思路一、安装这些东西,tornado, supervisor( sudo pip install supervisor 在linux 系统上), 安装 nginx (sudo apt-get install nginx -y)二、让supervior 和 已经写好的tornado 服务挂钩用supervisor 来管理服务和进程在命令行里面使用。然后,再在 supervisord.conf 最后面添加这几行这里tornado center.py 的本地服务地址是8100,写在center.py 文件里面了。当然为了标准,我们可以添加这几行在这里面,用来产看进程id,还有进程log(uni 阅读全文
posted @ 2014-02-17 17:33 spaceship9 阅读(1926) 评论(0) 推荐(0)
摘要:题外话: 这里分享一个链接是将Flask 和 Apache 用 mod_wsgi 来进行传唤的部署方式,在digital ocean VPS 上的。https://www.digitalocean.com/community/articles/how-to-deploy-a-flask-application-on-an-ubuntu-vps挺不错的。但是对于tornado 来说,我们最好是采用tornado 和 nginx,因为“Tornado 对WSGI只提供了有限的支持,即使如此,因为 WSGI 并不支持非阻塞式的请求,所以如果你使用 WSGI 代替 Tornado 自己的 HTTP 服 阅读全文
posted @ 2014-02-17 15:23 spaceship9 阅读(758) 评论(0) 推荐(0)
摘要:原文这里有显示地址:http://zhou123.blog.51cto.com/4355617/1312791现在摘取一部分:这里介绍一下python执行shell命令的四种方法:1、os模块中的os.system()这个函数来执行shell命令123>>> os.system('ls')anaconda-ks.cfg install.log install.log.syslog send_sms_service.py sms.py0注,这个方法得不到shell命令的输出。2、popen()#这个方法能得到命令执行后的结果是一个字符串,要自行处理才能得到想要的 阅读全文
posted @ 2014-02-13 09:26 spaceship9 阅读(1670) 评论(0) 推荐(0)
摘要:在tornado 里面这样用看看logging.warning() , logging.info() , 我们非常想用 zdaemon , 和 logging 将对系统的所有访问转换到服务器里面,作为日志。让我们看看目录树。transaction.py 是tornado服务看一下 testpage1handler@require_basic_authclass TestPage1Handler(BaseHandler): """This is a test page to show the asker's utmost parent's all d 阅读全文
posted @ 2014-01-21 00:52 spaceship9 阅读(1555) 评论(0) 推荐(0)
摘要:django User model operationthis tutorial will guide us to know how to manipulate django User model.Read User object derived from databasefrom django.contrib.auth.models import User# Those two lines are different even if there is only one user 'admin' who registered beforeauser = User.objects 阅读全文
posted @ 2013-12-18 20:06 spaceship9 阅读(578) 评论(0) 推荐(0)
摘要:Here I got a very neat plugin for vim which is awesome indeed.It's from youtube years before.So let's check this out. :)http://www.youtube.com/watch?v=67OZNp9Z0CQ&noredirect=1you can download the reference tools here: https://github.com/klen/python-mode#how-to-installSomeone mentioned ab 阅读全文
posted @ 2013-12-17 10:46 spaceship9 阅读(311) 评论(0) 推荐(0)
摘要:Read by linux/GNU commandsLet's follow and start from here:http://django-tastypie.readthedocs.org/en/latest/tutorial.html#creating-resourcesAccording to tastypie's concept, Tastypie properly handles the Accept header.So we can use linux/GNU commands to do some fancy things!Bash script to get 阅读全文
posted @ 2013-12-14 17:06 spaceship9 阅读(560) 评论(0) 推荐(0)
摘要:tastypie is a good thing.Haven't test it thoroughly. Gonna need some provement.Now I will introduct how to use tastepie for newbies.Let me introduce all the equipments I have to deploy tastypie.1) linuxmint 132) virtualenv ( sudo apt-get install python-virtualenv )3) install django==1.5 in the v 阅读全文
posted @ 2013-12-14 15:06 spaceship9 阅读(534) 评论(0) 推荐(0)
摘要:dango, 怎么说呢,什么东西都内置了,什么东西都是自己的东西。用过flask, cherrypy, web.py, pyramid 等等python 框架后,再选用dango 觉得,理念有很大的区别。藏着掖着的嫌疑比较大,高度封装,但是操作起来貌似省事情。时间久了会不会python的标准库不知道怎么用了,呵呵~这里一些简单的资料也许挺有用的。http://django-chinese-docs.readthedocs.org/en/latest/intro/tutorial01.htmlhttp://django-chinese-docs.readthedocs.org/en/latest 阅读全文
posted @ 2013-12-13 18:14 spaceship9 阅读(610) 评论(0) 推荐(0)
摘要:原文地址:http://www.cnblogs.com/XL-Liang/archive/2012/05/03/2481310.html这个地址也许更有帮助:http://www.cppblog.com/zzg/archive/2009/05/29/86066.html(这里有很多关于数据库处理的技巧)这么做,是新建了一个虚拟机,把数据库服务器放在虚拟机里面跑,然后通过虚拟机配置端口映射。一个电脑母机里面有很多子机的服务。这样有助于模拟与演示。1、登陆mysql数据库 mysql -u root -p 查看user表mysql> use mysql;Database changedmys 阅读全文
posted @ 2013-12-12 14:41 spaceship9 阅读(386) 评论(0) 推荐(0)
摘要:This is a great tutorial about tmux quick start:http://www.youtube.com/watch?v=wKEGA8oEWXw&noredirect=1and its text script , just read it :)http://timestream.net/screencasts/tmux-script.txtHere's the very nice functionailities.1)install tmux2)tmux works in this way.terminal ----- Tmux client 阅读全文
posted @ 2013-12-09 15:35 spaceship9 阅读(355) 评论(0) 推荐(0)
摘要:http://kivy.org/docs/api-kivy.uix.gridlayout.html?highlight=gridlayout#kivy.uix.gridlayoutIt's so nice to try this one:from kivy.app import Appfrom kivy.uix.gridlayout import GridLayoutfrom kivy.uix.label import Labelfrom kivy.uix.textinput import TextInputfrom kivy.uix.button import Buttonclass 阅读全文
posted @ 2013-12-03 17:30 spaceship9 阅读(879) 评论(0) 推荐(0)
摘要:Now that you've successfully coded an app. Now you want to deploy it to Android.So now we would need to have a look of this, from its official site:http://kivy.org/docs/guide/packaging.htmlLet's check this out.Mainly for Android .http://kivy.org/docs/guide/packaging-android.htmllet's do 阅读全文
posted @ 2013-12-03 16:00 spaceship9 阅读(472) 评论(0) 推荐(0)
摘要:http://kivy.org/docs/guide/basic.html#quickstartI followed this tutorial about how to create basic kivy application*********************Creating a kivy application is as simple as:sub-classing theAppclassimplementing itsbuild()method so it returns aWidgetinstance (the root of your widget tree)instan 阅读全文
posted @ 2013-12-03 14:10 spaceship9 阅读(355) 评论(0) 推荐(0)
摘要:Let's talk about kivy's EventDispatcher here:The codes I have tried here:codes here:from kivy.event import EventDispatcherclass MyEventDispatcher(EventDispatcher): def __init__(self, **kwargs): self.register_event_type('on_test') super(MyEventDispatcher, self).__init__(**kwargs) ... 阅读全文
posted @ 2013-12-03 10:57 spaceship9 阅读(550) 评论(0) 推荐(0)
摘要:[转]python普通继承方式和super继承方式原文出自:http://www.360doc.com/content/13/0306/15/9934052_269664772.shtml原文的错误,已经被我修改掉了。普通继承:class FooParent(object): def __init__(self): self.parent='Im the parent.' print 'Parent' def bar(self, message): print message, 'from Parent'class FooChild(Foo... 阅读全文
posted @ 2013-12-02 21:52 spaceship9 阅读(5815) 评论(0) 推荐(0)
摘要:Python tips: 什么是*args和**kwargs?原文地址:http://www.cnblogs.com/fengmk2/archive/2008/04/21/1163766.html先来看个例子:def foo(*args, **kwargs): print 'args = ', args print 'kwargs = ', kwargs print '---------------------------------------'if __name__ == '__main__': foo(1,2,3,4) fo 阅读全文
posted @ 2013-12-02 21:36 spaceship9 阅读(247) 评论(0) 推荐(0)
摘要:As we all know OpenERP is a great open-source ERP/CRM project.It does help people a lot when working in such a modern society.For those people who like to use free opensource software OpenERP is a good option.linuxmint 15 is a destro which is based on ubuntu 13.04 and has more futures. linuxmint 16 阅读全文
posted @ 2013-10-14 12:47 spaceship9 阅读(296) 评论(0) 推荐(0)
摘要:It's so painful to install nVidia driver by hand on linux.If you remove it or you want to upgrade by all your hand, you ought to need be very patient about this stuff coz it will kill you a lot of time.first you need to download the latest driver from their site.it looks like "NVIDIA-{versi 阅读全文
posted @ 2013-09-30 00:24 spaceship9 阅读(300) 评论(0) 推荐(0)
摘要:To know what it is, https://wiki.archlinux.org/index.php/Master_Boot_RecordFor a SD card, dd if=/dev/zero of=/dev/mmcblk0 bs=446 count=1 阅读全文
posted @ 2013-09-15 00:55 spaceship9 阅读(174) 评论(0) 推荐(0)