Skip to content

Commit 9de476f

Browse files
author
Alexander Smishlajev
committed
fix: server was always started on default port number.
remove unused imports
1 parent 60489a4 commit 9de476f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

demo.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
#
33
# Copyright (c) 2003 Richard Jones ([email protected])
44
#
5-
# $Id: demo.py,v 1.19 2004-10-18 07:46:59 a1s Exp $
5+
# $Id: demo.py,v 1.20 2004-10-19 08:04:12 a1s Exp $
66

7-
import sys, os, string, re, urlparse, ConfigParser
8-
import shutil, socket, errno, BaseHTTPServer
7+
import errno
8+
import os
9+
import socket
10+
import sys
11+
import urlparse
912
from glob import glob
1013

1114
from roundup import configuration
@@ -91,17 +94,20 @@ def run_demo(home):
9194
"""Run the demo tracker installed in ``home``"""
9295
roundup_server.RoundupRequestHandler.TRACKER_HOMES = {'demo': home}
9396
cfg = configuration.CoreConfig(home)
97+
url = cfg["TRACKER_WEB"]
98+
hostname, port = urlparse.urlparse(url)[1].split(':')
99+
port = int(port)
94100
success_message = '''Server running - connect to:
95101
%s
96102
1. Log in as "demo"/"demo" or "admin"/"admin".
97103
2. Hit Control-C to stop the server.
98104
3. Re-start the server by running "python demo.py" again.
99105
4. Re-initialise the server by running "python demo.py nuke".
100-
''' % cfg["TRACKER_WEB"]
106+
''' % url
101107

102108
# disable command line processing in roundup_server
103109
sys.argv = sys.argv[:1]
104-
roundup_server.run(success_message=success_message)
110+
roundup_server.run(port=port, success_message=success_message)
105111

106112
def demo_main():
107113
"""Run a demo server for users to play with for instant gratification.

0 commit comments

Comments
 (0)