Differences between revisions 9 and 17 (spanning 8 versions)
Revision 9 as of 2007-02-25 09:03:16
Size: 2788
Editor: ZoomQuiet
Comment:
Revision 17 as of 2009-12-25 07:08:59
Size: 3345
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
[[TableOfContents]] <<TableOfContents>>
Line 26: Line 26:
===> Registering installation for py24-imaging-1.1.5_2
===> Cleaning for python24-2.4.3_3
===> Cleaning for jpeg-6b_4
===> Cleaning for freetype2-2.2.1_1
===> Cleaning for libtool-1.5.22_2
===> Cleaning for gmake-3.81_1
===> Cleaning for pkg-config-0.21
===> Cleaning for gettext-0.14.5_2
===> Cleaning for libiconv-1.9.2_2
===> Cleaning for py24-imaging-1.1.5_2
Line 43: Line 32:
 * [http://docutils.sourceforge.net/ docutils] 0.40 [http://prdownloads.sourceforge.net/docutils/docutils-0.4.tar.gz?download Download]
 * [http://pygments.org/ pygments] 0.6+ [http://pygments.org/media/pygmentsdocs.tar.gz Download]
 * [http://www.pythonware.com/products/pil/ PIL] 1.1.5+
 * [[http://docutils.sourceforge.net/|docutils]] 0.40 [[http://prdownloads.sourceforge.net/docutils/docutils-0.4.tar.gz?download|Download]]
 * [[http://pygments.org/|pygments]] 0.6+ [[http://pygments.org/media/pygmentsdocs.tar.gz|Download]]
 * [[http://www.pythonware.com/products/pil/|PIL]] 1.1.5+
Line 99: Line 88:
=== 准备 ===
{{{$cd /usr/ports/www/mod_fastcgi
$sudo make install clean
}}}
=== limodou的配置 ===
这是我在 http://limodou.51boo.com 上的配置,仅供参考
Line 100: Line 96:

{{{
#!/usr/local/bin/python
import sys, os

sys.path = ['','/var/www/virtual/limodou.51boo.com/lib', '/var/www/virtual/limodou.51boo.com/django_projects', '/var/www/virtual/limodou.51boo.com/django_projects/openbook'] + sys.path

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(["method=threaded", "daemonize=false", "pidfile=pidfile"])
}}}
   
Line 101: Line 111:

{{{
AddHandler fcgid-script .fcgi
Options +FollowSymLinks +ExecCGI

RewriteEngine On
RewriteBase /
#RewriteRule ^/(media.*)$ /$1 [QSA,L]
#RewriteRule ^/(site_media.*)$ /$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ limodou.fcgi/$1 [QSA,L]
}}}

lighttpd+fastcgi

SVN 重新发布

为了被封的同志可以使用 80端口进行访问:

$cd /usr/ports/www/apache22
$make WITH_AUTH_MODULES=yes WITH_DAV_MODULES=yes \
WITH_SSL_MODULES=yes WITH_BERKELEYDB=db42 install clean

$cd /usr/ports/devel/subversion
$make -DWITH_SVNSERVE_WRAPPER -DWITH_MOD_DAV_SVN \
-DWITH_APACHE2_APR install clean

准备

安装相关组件:

$sudo pkg_add -rv lighttpd
$cd /usr/ports/www/py-flup
$sudo make install clean
$cd /usr/ports/graphics/py-imaging
$sudo make install clean
...

配置

相关模块:

Settings 说明

DATABASE_ENGINE = 'sqlite3'           # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = './database.db'             # Or path to database file if using sqlite3.
DATABASE_USER = ''             # Not used with sqlite3.
DATABASE_PASSWORD = ''         # Not used with sqlite3.
DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.

根据需要进行修改数据库的配置。

MEDIA_ROOT = 'media/'

在Apache上时应为绝对路径。如:/var/home/xxx/htdocs/media/,权限请设置正确,不行为777。

ROOT_URLCONF = 'openbook.urls'

注意,这里路径为openbook ,因此如果你的目录不是openbook ,则请修改成正确的路径。

SITE_MEDIA = './media'

在Apache上时应为绝对路径。如:/var/home/xxx/htdocs/media/,权限请设置正确,不行为777。

创建数据库

当settings.py设置完毕之后,可以先创建数据库。

python manage.py syncdb

对于sqlite3数据库要注意:

  • 数据库文件应为绝对路径
  • 注意数据库文件权限应可以读写,如 744

启动开发服务器进行测试:

python manage.py runserver

Apache 上 Fastcgi 的配置

准备

{{{$cd /usr/ports/www/mod_fastcgi $sudo make install clean }}}

limodou的配置

这是我在 http://limodou.51boo.com 上的配置,仅供参考

  • django.fcgi

import sys, os

sys.path = ['','/var/www/virtual/limodou.51boo.com/lib', '/var/www/virtual/limodou.51boo.com/django_projects', '/var/www/virtual/limodou.51boo.com/django_projects/openbook'] + sys.path

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(["method=threaded", "daemonize=false", "pidfile=pidfile"])
  • .htaccess

AddHandler fcgid-script .fcgi
Options +FollowSymLinks +ExecCGI

RewriteEngine On
RewriteBase /
#RewriteRule ^/(media.*)$ /$1 [QSA,L]
#RewriteRule ^/(site_media.*)$ /$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ limodou.fcgi/$1 [QSA,L]

ObpLatform/2007-02-24 (last edited 2009-12-25 07:08:59 by localhost)