index 0c601dcb72061ac39e39cb502039f004c5f48ee3..2a5c95780cf3f472ba8dbdb64a5a599cb5b2ce7c 100644 (file)
--- a/demo.py
+++ b/demo.py
#
# Copyright (c) 2003 Richard Jones (richard@mechanicalcat.net)
#
-# $Id: demo.py,v 1.2 2003-05-11 07:33:55 richard Exp $
+# $Id: demo.py,v 1.7 2003-11-06 14:24:57 jlgijsbers Exp $
import sys, os, string, re, urlparse
import shutil, socket, errno, BaseHTTPServer
def install_demo(home):
# create the instance
- try:
- if os.path.exists(home):
- shutil.rmtree(home)
- except os.error, error:
- if error.errno != errno.ENOENT:
- raise
+ if os.path.exists(home):
+ shutil.rmtree(home)
from roundup import init, instance, password
init.install(home, os.path.join('templates', 'classic'))
# don't have email flying around
os.remove(os.path.join(home, 'detectors', 'nosyreaction.py'))
+ try:
+ os.remove(os.path.join(home, 'detectors', 'nosyreaction.pyc'))
+ except os.error, error:
+ if error.errno != errno.ENOENT:
+ raise
init.write_select_db(home, 'anydbm')
# figure basic params for server
port = int(port)
# ok, so start up the server
- from roundup.scripts.roundup_server import RoundupRequestHandler
- RoundupRequestHandler.TRACKER_HOMES = {'demo': home}
- httpd = BaseHTTPServer.HTTPServer((hostname, port), RoundupRequestHandler)
- print 'Server running - connect to:\n %s'%url
- print '1. Log in as "demo"/"demo" or "admin"/"admin".'
- print '2. Hit Control-C to stop the server.'
- print '3. Re-start the server by running "python demo.py" again.'
- print '4. Re-initialise the server by running "python demo.py nuke".'
- try:
- httpd.serve_forever()
- except KeyboardInterrupt:
- print 'Keyboard Interrupt: exiting'
+ from roundup.scripts import roundup_server
+ roundup_server.RoundupRequestHandler.TRACKER_HOMES = {'demo': home}
+
+ success_message = '''Server running - connect to:
+ %s
+1. Log in as "demo"/"demo" or "admin"/"admin".
+2. Hit Control-C to stop the server.
+3. Re-start the server by running "python demo.py" again.
+4. Re-initialise the server by running "python demo.py nuke".''' % url
+
+ sys.argv = sys.argv[:1]
+ roundup_server.run(port, success_message)
if __name__ == '__main__':
run_demo()