Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adds an additional parameter so SCGI port can be defined from the

command line.

git-svn-id: svn://cherokee-project.com/web/branches/beta-ctk@6587 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
commit 906e76179bc8af8101f9e937e66cbc3646933ed3 1 parent fc6ec5f
@alobbs alobbs authored
Showing with 12 additions and 3 deletions.
  1. +3 −1 CHEROKEE_WEB-server.py
  2. +1 −1  cherokee.conf
  3. +8 −1 test.py
View
4 CHEROKEE_WEB-server.py
@@ -24,6 +24,8 @@
# 02110-1301, USA.
#
+import os
+
import CTK
import PageIndex
import PageDownload
@@ -36,4 +38,4 @@
import PageLicense
import PageMarketing
-CTK.run (port=8090)
+CTK.run (port = int(os.getenv('SCGI_PORT', '8090')))
View
2  cherokee.conf
@@ -35,7 +35,7 @@ vserver!1!rule!1!match = default
source!2!env_inherited = 1
source!2!host = localhost:8090
source!2!interpreter = python CHEROKEE_WEB-server.py
-source!2!nick = localhost 8090
+source!2!nick = localhost:8090
source!2!type = interpreter
icons!default = page_white.png
icons!directory = folder.png
View
9 test.py
@@ -5,21 +5,28 @@
if len(sys.argv) < 2:
print "USAGE:"
- print " %s /path/to/CTK" %(sys.argv[0])
+ print " %s /path/to/CTK [SCGI port]" %(sys.argv[0])
raise SystemExit
cwd = os.getcwd()
ctk_dir = os.path.abspath (sys.argv[1])
+# SCGI Port
+port = 8090
+if len(sys.argv) > 2:
+ port = sys.argv[2]
+
# Read
cont = open ('cherokee.conf','r').read()
cont = cont.replace ('python CHEROKEE_WEB-server.py', 'python %s/CHEROKEE_WEB-server.py'%(cwd))
cont = cont.replace ('/change/CTK', '%s/static'%(ctk_dir))
cont = cont.replace ('/change/static', '%s/static'%(cwd))
+cont = cont.replace ('localhost:8090', 'localhost:%s'%(port))
# Write
open ('cherokee.conf.2', 'w+').write(cont)
# Execute
os.putenv("PYTHONPATH", "%s:%s"%(ctk_dir, os.getenv("PYTHONPATH", '')))
+os.putenv("SCGI_PORT", str(port))
os.system ("cherokee -C cherokee.conf.2")
Please sign in to comment.
Something went wrong with that request. Please try again.