MoinMoin seperate theme folder from MoinMoin htdocs folder

550 views Asked by At

I'd like to seperate my custom theme folder from the default MoinMoin htdocs folder. Here is my directory structure of my current installation:

/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/...
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/index.html
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/classic
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/modern
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/mytheme
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/mytheme/style.css

And my custom Git-versioned wiki/data directory:

/path/to/git-repo/wikiconfig.py
/path/to/git-repo/wikiserver.py
/path/to/git-repo/wiki/data/...
/path/to/git-repo/wiki/data/plugin/theme/mytheme.py
/path/to/git-repo/wiki/underlay/...

The wikiconfig.py contains the following configuration:

class LocalConfig(multiconfig.DefaultConfig):
  wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
  instance_dir = os.path.join(wikiconfig_dir, 'wiki')
  data_dir = os.path.join(instance_dir, 'data', '') # path with trailing /
  data_underlay_dir = os.path.join(instance_dir, 'underlay', '') # path with trailing /
  DesktopEdition = True # give all local users full powers
  acl_rights_default = u"All:read,write,delete,revert,admin"
  surge_action_limits = None # no surge protection
  sitename = u'Foo'
  logo_string = u'<span><img src="...">Bar</span>' % url_prefix_static
  page_front_page = u'StartPage'
  theme_default = 'mytheme'

I would like to move the theme's static files to the /path/to/git-repo folder, because this directory is a Git repository which should contain all custom modifications, and also the theme's static files.

Any ideas how this could be done?

Regards

1

There are 1 answers

0
Thomas Waldmann On

I suggest you just leave the builtin static stuff where it is.

What you can do for custom and separate theme development is to serve your static stuff at some specific URL and catch that URL in the web server before it gets given to moin.wsgi (and ends up being served by MoinMoin's builtin static file server), something like:

Alias /moin_static196/mytheme /path/to/git-repo/static
WSGIScriptAlias / /..../moin.wsgi

/moin_static196 is the url path moin 1.9.6 uses by default, you can modify it in wikiconfig.py to use anything you like.

You would put the theme python code also into your git repo and just symlink it from the instances data/plugin/theme/ directory.