[Moin-user] WSGI config without admin interaction

Thomas Waldmann tw-public at gmx.de
Mon Jan 12 06:56:48 EST 2009


Seems like this post from graham didn't get through to the list:

On Jan 12, 11:06 am, Thomas Waldmann <tw-pub... at gmx.de> wrote:
> >    sys.path.insert(0, '/home/flindner/moinmoin/test_instance')
> >    sys.path.insert(0, '/home/flindner/moinmoin/lib/python2.5/site-
> > packages')
>
> You should insert the wiki config directory LAST, so it is at the very
> beginning of sys.path.
>
> > wikiconfig.py in test_instance needs to have absolute paths for
the  
> > data and underlay dir or - I guess - relative to moin.wsgi.
>
> Better use absolute.
>
> >    RewriteCond %{REQUEST_URI} ^/testwiki/
> >    RewriteRule ^(.*)$ /moin.wsgi/$1 [L]
>
> I think you can do this easier just with RewriteRule.
>
> BTW, mod_rewrite had some issues in the past with pagenames ending
with
> a question mark. You could check if this still happens.

Have already send one post on this, but looks like that disappeared
into a black hole or the moderators queue. That post explained a way
of doing this using MultiViews, but also realised there is another
way. That is instead of calling file 'moin.wsgi', call it just
'testwiki' and then in .htaccess file have:

  Options ExecCGI

  <Files testwiki>
  SetHandler wsgi-script
  </Files>

Thus, rather than matching on extension, just say that that specific
file should be handled as a WSGI script. When URL is /testwiki and
therefore matches file name, it will use the script.

The other way, in case it did vanish into a black hole is to rename
'moin.wsgi' to 'testwiki.wsgi' and then in .htaccess file have:

  Options ExecCGI MultiViews
  MultiviewsMatch Handlers
  AddHandler wsgi-script .wsgi

Enabling of MultiViews means that .wsgi extension can be left out of
URL, so URL of '/textwiki' will be matched to 'testwiki.wsgi'
automatically.

Both approaches eliminate need to use rewrite rules. Only time you
need rewrite rules if wanting a .wsgi file in a directory to appear
mounted on the directory. More explanations in:


http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive

Graham






More information about the Moin-user mailing list