15
十二/08
1

Linux下django开发

在archLinux下做web开发是非常方便的,源里面大部分东西都有了。我们今天来进行django的学习尝试。

首先,安装django,源里面已经打包好了。直接安装,sudo pacman -Sy django

安装完后,我们去/usr/lib/python2.6/site-packages/django目录下,其中python2.6目录是当前我的python版本,当前目录下有个bin目录,建议将此路径加入到系统path里面去,省得每次都要输入完整路径。

我们现在在自己的开发目录下面,比如arch的标准web目录/srv/http下面来创建我们的第一个django项目。

django-admin.py startproject hello 类似ROR,这个脚本为我们自动生成了hello这个项目的整体框架文件。
注意django-admin.py这个脚步要加上完整路径,并且默认是不可执行的,可以通过chmod +x加入可执行权限,或者以python脚本的形式执行。我们来启动服务 ./manage.py runserver

Django version 1.0.2 final, using settings ‘terrysco.settings’
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[15/Dec/2008 01:52:07] "GET / HTTP/1.1" 200 2057
Validating models…
0 errors found
访问本地的8000端口,即可看到django的欢迎页面。
项目目录里面的uls.py负责指定路径到app的映射,类似drupal的菜单系统。这里我们是为了做测试用,所以就直接建立一个test.py,里面写一些测试脚本。
from django.http import HttpResponse
def index(request):
      return HttpResponse("Hello, World.")
很简单吧,讲index请求指定显示hello world内容。到这里还不行,需要在uls.py里面指定。
在urlpatterns里面加入一行(r’^$’, ‘hello.test.index’),这个简单的正则指出如果根路径后面为空,则打印我们的hello world。

当然,这里我们没有分离模板,使用from django.shortcuts import render_to_response则可以使用模板渲染数据。类似PHP+Smarty的技术,模板里面可以加入对传递进来参数的处理。

7
十二/08
3

kde4[archlinux]

今天想尝试下kde4的新特性,先依照wiki的设置,http://wiki.archlinux.org/index.php/KDEmod(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

安装kdemod,现在源里面是kdemod4了。装完后启动kdm登录进来后,进行一些常用设置,唯一麻烦的是knetworkmanager默认没有了,安装了一个,还需要qt3。连接上无线,安装了一个gtk-chtheme,调整了下gtk程序在kde中的显示样式,要不然太丑了。

新版的kate和kopete都更改很大,使用起来更加顺手,并且函数列表功能现在已经默认内置为kate的插件,在插件中启用即可。kopete中有qq协议,但是没有登录成功。

果然是kde4,果然绚丽,眼睛快花了。。。 

关键字: , ,
28
十一/08
1

archlinux下配置触摸版

首先,pacman -S synaptics安装驱动。紧接着看下面的配置帮助信息。

 1. For use with kernel 2.6.x you need to enable synaptics touchpad
[2008-11-28 16:23] support when configuring the kernel (CONFIG_MOUSE_PS2). You also
[2008-11-28 16:23] need support for the evdev interface (CONFIG_INPUT_EVDEV). If you
[2008-11-28 16:23] compile evdev as a module, make sure it is loaded before starting
[2008-11-28 16:23] the X server, as it will not be auto-loaded
[2008-11-28 16:23]
[2008-11-28 16:23] ==> 2. Change your /etc/X11/XF86Config or /etc/X11/xorg.conf:
[2008-11-28 16:23]  
[2008-11-28 16:23] – Load the driver by changig the XFree configuration file
[2008-11-28 16:23] adding the line ‘Load "synaptics"’ in the module section
[2008-11-28 16:23]  
[2008-11-28 16:23] – Add/Replace in the InputDevice section for the touchpad the
[2008-11-28 16:23] following lines:
[2008-11-28 16:23]
[2008-11-28 16:23] Section "InputDevice"
[2008-11-28 16:23] Driver "synaptics"
[2008-11-28 16:23] Identifier "Mouse[1]"
[2008-11-28 16:23] Option "Device" "/dev/psaux"
[2008-11-28 16:23] Option "Protocol" "auto-dev"
[2008-11-28 16:23] Option "LeftEdge" "1700"
[2008-11-28 16:23] Option "RightEdge" "5300"
[2008-11-28 16:23] Option "TopEdge" "1700"
[2008-11-28 16:23] Option "BottomEdge" "4200"
[2008-11-28 16:23] Option "FingerLow" "25"
[2008-11-28 16:23] Option "FingerHigh" "30"
[2008-11-28 16:23] Option "MaxTapTime" "180"
[2008-11-28 16:23] Option "MaxTapMove" "220"
[2008-11-28 16:23] Option "VertScrollDelta" "100"
[2008-11-28 16:23] Option "MinSpeed" "0.06"
[2008-11-28 16:23] Option "MaxSpeed" "0.12"
[2008-11-28 16:23] Option "AccelFactor" "0.0010"
[2008-11-28 16:23] Option "SHMConfig" "on"
[2008-11-28 16:23] # Option "Repeater" "/dev/ps2mouse"
[2008-11-28 16:23] EndSection
[2008-11-28 16:23]
[2008-11-28 16:23] – Change the Identifier to the same name as in the ServerLayout section.
[2008-11-28 16:23] The Option "Repeater" is at the moment for testing.
[2008-11-28 16:23]
[2008-11-28 16:23] – Add the "CorePointer" option to the InputDevice line at the ServerLayout section:
[2008-11-28 16:23]
[2008-11-28 16:23] Section "ServerLayout"
[2008-11-28 16:23] InputDevice "Mouse[1]" "CorePointer"
[2008-11-28 16:23]
[2008-11-28 16:23] – Note! You can not have more than one core pointer, so if you want
[2008-11-28 16:23] to use an external mouse too, you have to set all mouse input
[2008-11-28 16:23] devices except one to "AlwaysCore" instead of "CorePointer".
[2008-11-28 16:23] installed synaptics (0.14.6.99-2)

总结如下:根据上面的帮助修改xorg文件。问题解决,触摸版边缘的滚动功能可以使用了。
 

20
十/08
0

近期我的archlinux配置日志

用ipw3945时在挂起恢复之后一直不能正常恢复,我们狼族小四同学给的建议,去arch官方wiki看了下,把无线网卡驱动从ipw3945换成了iwlwifi3945。ipw3945是intel自家出的私有驱动,使用时要首先加载ipw3945模块,然后开启ipw3945d的DAEMON。iwl3945则只需要加载iwl3945模块就行了。

pacman -S iwlwifi-3945-ucode

官方给出的提示: ipw3945驱动已经停止开发了. 上边提到的iwlwifi应该工作的很好。

firefox3卡的难受,暂时用swiftfox替代掉。速度快了好多,以前页面加载卡住的问题不复存在了。

geany今天从源里面更新到了0.15,多了很多细心的功能。不错~

google了一下调整音量乱跳的解决办法,解决了用音量键的时候会出现音量乱跳的现象。解决方案如下:系统->首选项->音效。将默认混音器轨道设置为OSS Mixer即可。(参看http://www.zcliu.net)

源里面已经可以升级gnome了,但暂时没有尝试。小四同学说有点bug很麻烦,等解决后再打算升级吧。

 

关键字: ,
15
十/08
0

archlinux安装EIO(永中office)

没办法,还是要在linux系统上看一些doc文档,openoffice支持太差了,对简历等等文件的修改造成了很多麻烦,并且archlinux源里面的ooo默认安装在/opt目录下,刚开始分区没有规划好,导致根分区就剩下仅仅的50M空间,而OOO就占用了差不多300M。
今天看到永中office出了最新的免费个人版本,虽然这个东西是java做得,但是这个新版本速度相当快,并且是国产软件,对MS Office文档格式的支持要比OpenOffice好,如果Word,Exel的文件较多,可以考虑这个。

永中集成Office 2009 个人版,下载地址是http://www.evermoresw.com.cn/webch/download/downEIOPersonal.jsp,里面有Linux版本。
$ tar zxf EIO2007_Trial_ZH_Lin.tar.gz
用su命令登录root,再进入解压后文件夹
# ./setup.sh (进入永中Office的图形界面安装,指定一下安装目录)
安装完成后,要以root身份运行一下永中:
# eio; exit
$ cd ~ ; seteio (为普通用户配置下永中)
$ eio (从终端运行永中Office,或者从菜单中运行也可以)

如果不进行上面的操作,直接运行菜单没有任何反应,命令行下会提示找不到文件。

关键字: , ,