-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·32 lines (25 loc) · 832 Bytes
/
test.py
File metadata and controls
executable file
·32 lines (25 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
import os
import sys
if len(sys.argv) < 2:
print "USAGE:"
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")