#!/usr/bin/env python
"""
    Start script for the DesktopEdition StandAlone WikiServer.

    @copyright: 2004 Thomas Waldmann, Nir Soffer, Alexander Schremmer
    @license: GNU GPL, see COPYING for details.
"""

print "Loading ..."

import os, sys

class PythonTooOldError: pass

try:
    if sys.version_info[:3] < (2, 3, 0):
        raise PythonTooOldError
except:
    sys.exit("Unfortunately, your installed Python is too old. Please download at"
             " least Python 2.3.0, while Python 2.4.2 is recommended.\n\n"
             "You can get Python here: http://www.python.org/download/")
    
moinpath = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
sys.path.insert(0, moinpath)

from MoinMoin.server.standalone import StandaloneConfig, run
from MoinMoin.version import project, release, revision

print "%s - %s [%s]" % (project, release, revision)

if os.name == 'nt':
    print
    print "Just close this window to shutdown MoinMoin DesktopEdition."

print

class DefaultConfig(StandaloneConfig):
    docs = os.path.join(moinpath, 'wiki', 'htdocs')

    # Port (default 8080)
    # To serve privileged port under 1024 you will have to run as root
    port = 8080

    # Interface (default 'localhost')
    # '' - will listen to any interface
    interface = 'localhost'

try:
    from wikiserverconfig import Config
except ImportError:
    Config = DefaultConfig

# Run moin moin server:
run(Config)
