Total Pageviews

Friday, 6 December 2013

在virtualenv下搭建基于python+django1.2.3的博客程序-youflog0.4和youflog0.3

virtualenv youflog-new
cd youflog-new
source bin/activate
pip install Django==1.2.3 (youflog仅支持Django==1.2系列。不要装其他版本的django!)
(也可这样装django1.2.3:
wget https://www.djangoproject.com/m/releases/1.2/Django-1.2.3.tar.gz
tar xzvf Django-1.2.3.tar.gz
cd Django-1.2.3
python setup.py install)
pip install pil

wget http://youflog.googlecode.com/files/youflog_0.4.tar.gz
tar zxvf youflog_0.4.tar.gz
cd youflog
(或者这样:
svn checkout http://youflog.googlecode.com/svn/trunk/ youflog
cd youflog )
youflog_0.4默认所使用的数据库为sqlite3,因此无需去编辑settings.py文件。
cat settings.py
...
DATABASES = {
    'default': {
        'ENGINE':'django.db.backends.sqlite3',
        'NAME':os.path.join(HERE,'youflog.sqlite'),
    }
}
...
(youflog-new)as3:~/youflog-new/youflog# ls
BeautifulSoup.py   __init__.pyc  settings.py   templates  wsgi.py
BeautifulSoup.pyc  manage.py     settings.pyc  urls.py    youflogprocessor.py
blog               media         static        urls.pyc   youflogprocessor.pyc
__init__.py        pingback      tagging       utils      youflog.sqlite
(youflog-new)as3:~/youflog-new/youflog# python manage.py syncdb
(youflog-new)as3:~/youflog-new/youflog# nohup python manage.py runserver 0.0.0.0:10002 > /dev/null &

演示站点:http://as3.brite.biz:10002/ (里面的链接有问题,还未弄明白怎么设置)
项目地址:http://code.google.com/p/youflog
下载地址:http://youflog.googlecode.com/files/youflog_0.4.tar.gz
http://code.google.com/p/youflog/wiki/INSTALL (选择性阅读)
--------------------------------------------------------------------------
在virtualenv下搭建基于python+django1.2.3的博客程序-youflog0.3

 virtualenv youflog-0.3
cd youflog-0.3

source bin/activate

pip install Django==1.2.3 (youflog仅支持Django==1.2系列。不要装其他版本的django!)

(也可这样装django1.2.3:

wget https://www.djangoproject.com/m/releases/1.2/Django-1.2.3.tar.gz

tar xzvf Django-1.2.3.tar.gz

cd Django-1.2.3

python setup.py install)

pip install pil

wget http://youflog.googlecode.com/files/youflog-0.3.tar.gz

tar zxvf youflog-0.3.tar.gz

cd youflog

youflog-0.3默认所使用的数据库为sqlite3,但是仍然可编辑settings.py文件,改用mysql数据库:
nano settings.py (输入你的mysql数据库细节)

(youflog-new)as3:~/youflog-new/youflog# python manage.py syncdb
(如果遇到出错提示:Error loading MySQLdb module: No module named MySQLdb
则:
(youflog-0.3)as3:~/youflog-0.3/youflog# pip install mysql-python

(youflog-0.3)as3:~/youflog-0.3/youflog# python manage.py syncdb (同步数据库表)
显示:
The following content types are stale and need to be deleted:
    blog | userprofile
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.
    Type 'yes' to continue, or 'no' to cancel: no
No fixtures found. (因为我以前装过youflog,是在django1.2.3/1.3环境下装的。我的django升级到1.4后,
youflog就不正常了。所以我现在在虚拟环境下,安装django1.2.3,再来安装youflog.并且我以前使用的数据库是mysql,所以我在编辑settings.py时,选择的数据库依然是mysql,并且输入的数据库名还是以前的那个数据库名,这样方便恢复数据!也正因为我输入的mysql数据库名是以前的数据库名,它并非空数据库,所以运行
python manage.py syncdb后,并不显示创建数据库表的过程,而是如上的显示。所以对它的问题的回答应是no.否则博客的数据会被删得一干二净)
(youflog-0.3)as3:~/youflog-0.3/youflog# python manage.py runserver 0.0.0.0:10003
Validating models...
0 errors found

Django version 1.2.3, using settings 'youflog.settings'
Development server is running at http://0.0.0.0:10003/
Quit the server with CONTROL-C.

(youflog-new)as3:~/youflog-new/youflog# nohup python manage.py runserver 0.0.0.0:10003 > /dev/null &

演示站点:http://as3.brite.biz:10003/ (这样我的旧博客就得以恢复了)
项目地址:http://code.google.com/p/youflog
下载地址:http://youflog.googlecode.com/files/youflog-0.3.tar.gz
http://code.google.com/p/youflog/wiki/INSTALL (选择性阅读)

这个youflog程序的0.4版,0.32版不太好用(0.32版我根本就没安装成功)。0.3版蛮好用的。可见程序并不一定越新就越好用!