Differences between revisions 1 and 2
Revision 1 as of 2006-01-09 07:29:23
Size: 604
Editor: hoxide
Comment:
Revision 2 as of 2006-01-09 07:32:25
Size: 2274
Editor: hoxide
Comment:
Deletions are marked like this. Additions are marked like this.
Line 25: Line 25:
<VirtualHost *:8066>
  ServerAdmin [email protected]
  DocumentRoot "g:/pyblog"
  ServerName blog.example.com
  <Location /weblog>
      AddDefaultCharset utf-8
      PythonDebug off
      SetHandler python-program
      # set PythonPath to the folders containing the files.
      PythonPath "['g:/pyblog/myblog']+sys.path"
      PythonHandler mp_wsgi_handler::wsgi_handler
      # This should be the same as the Location above
      PythonOption ApplicationPath /weblog
      PythonOption application wsgi_app::application
   </Location>
Line 26: Line 41:
</VirtualHost>
}}}

== 修改 wsgi_app.py ==

{{{
#!python
# Pyblosxom imports
from Pyblosxom.pyblosxom import PyBlosxom
from Pyblosxom import tools
import pprint
from string import find as _find
from config import py as cfg
if cfg.has_key("codebase"):
    sys.path.insert(0, cfg["codebase"])

...

def application(env, start_response):

    try: # regular application code here

        # ensure that PATH_INFO exists. a few plugins break if this is missing.
        if not 'PATH_INFO' in env:
            env['PATH_INFO'] = ""
            
        username = env['PATH_INFO'].split('/', 2)[1]
        cfg['datadir'] = "g:/pyblog/%s/datadir"%username
        cfg['comment_dir'] = "g:/pyblog/%s/comments"%username
        
        #env['SCRIPT_NANE'] = "%s/%s"%(env['SCRIPT_NAME'], username)
        env['PATH_INFO'] = env['PATH_INFO'][len(username)+1:]
        cfg['base_url'] = '%s://%s%s/%s' % (env['wsgi.url_scheme'], env['HTTP_HOST'], env['SCRIPT_NAME'],username)

        logger = tools.getLogger(logfilename)
        logger.debug(pprint.pformat(
            dict([(k , v) for k, v in env.items() if k in envdkeys])))
                     
                     
        p = PyBlosxom(cfg, env)
        p.run()
Line 28: Line 84:

==== 次节标题1 ====
xxx

== 章标题2 ==

=== 小节标题2 ===
{{{
其它
代码引用
}}}

==== 次节标题2 ====
yyy

含有章节索引的中文 文章模板

::-- hoxide [DateTime(2006-01-09T07:29:23Z)] TableOfContents

1. PyBlosxom Multuser

简述

1.1. 软件环境

  • Windows 2003
  • Python 2.4.1
  • Pyblosxom 1.3 dev
  • Apache 2.0
  • Mod_Python 3.2.5b
  • WSGI ref
  • mp_wsgi_handler

1.2. Apache 设置

<VirtualHost *:8066>
  ServerAdmin [email protected]
  DocumentRoot "g:/pyblog"
  ServerName blog.example.com
  <Location /weblog>
      AddDefaultCharset utf-8
      PythonDebug off
      SetHandler python-program
      # set PythonPath to the folders containing the files.
      PythonPath "['g:/pyblog/myblog']+sys.path"
      PythonHandler mp_wsgi_handler::wsgi_handler
      # This should be the same as the Location above
      PythonOption ApplicationPath /weblog
      PythonOption application wsgi_app::application
   </Location>

</VirtualHost>

1.3. 修改 wsgi_app.py

   1 # Pyblosxom imports
   2 from Pyblosxom.pyblosxom import PyBlosxom
   3 from Pyblosxom import tools
   4 import pprint
   5 from string import find as _find
   6 from config import py as cfg
   7 if cfg.has_key("codebase"):
   8     sys.path.insert(0, cfg["codebase"])
   9 
  10 ...
  11 
  12 def application(env, start_response):
  13 
  14     try: # regular application code here
  15 
  16         # ensure that PATH_INFO exists. a few plugins break if this is missing.
  17         if not 'PATH_INFO' in env:
  18             env['PATH_INFO'] = ""
  19             
  20         username = env['PATH_INFO'].split('/', 2)[1]
  21         cfg['datadir'] = "g:/pyblog/%s/datadir"%username
  22         cfg['comment_dir'] = "g:/pyblog/%s/comments"%username
  23         
  24         #env['SCRIPT_NANE'] = "%s/%s"%(env['SCRIPT_NAME'], username)
  25         env['PATH_INFO'] = env['PATH_INFO'][len(username)+1:]
  26         cfg['base_url'] = '%s://%s%s/%s' % (env['wsgi.url_scheme'], env['HTTP_HOST'], env['SCRIPT_NAME'],username)
  27 
  28         logger = tools.getLogger(logfilename)
  29         logger.debug(pprint.pformat(
  30             dict([(k , v) for k, v in env.items() if k in envdkeys])))
  31                      
  32                      
  33         p = PyBlosxom(cfg, env)
  34         p.run() 

PyBlosxoMultuser (last edited 2009-12-25 07:18:27 by localhost)