Commits

Jason R. Coombs  committed 0ffd3b8

Created routine for creating the IIS site

  • Participants
  • Parent commits 79d09ad

Comments (0)

Files changed (2)

File adamsrow/tracker/isapi.py

 
 def setup_application():
 	import adamsrow.tracker
-	return adamsrow.tracker.init()
+	tracker_home = os.path.join(appdir)
+	return wsgi_handler.RequestDispatcher(tracker_home)
 
 def factory():
 	"The entry point for when the ISAPIDLL is triggered"
 
 def create_site():
 	root = 'C:\\inetpub\\adams row tracker'
-	os.makedirs(root)
+	# todo: create site using 'roundup-admin install' and edit config
 	script = os.path.join(root, 'tracker.py')
 	open(script, 'w').write(dedent("""
 		from adamsrow.tracker.isapi import (
 		if __name__ == '__main__': handle_command_line()
 		"""))
 	#subprocess.check_call([sys.executable, script, 'install'])
+
+def appcmd(cmd, **kwargs):
+	if isinstance(cmd, basestring):
+		cmd = cmd.split()
+	args = ['/{key}:"{value}"' for key, value in kwargs.items()]
+	return subprocess.check_call([
+		'\Windows\System32\InetSrv\appcmd.exe',
+		] + cmd + args
+
+def create_iis_site(root):
+	appcmd('add site',
+		id = '3',
+		name = 'Adams Row Tracker'
+		physicalPath = root
+		bindings = 'http://*:80:tracker.adamsrowcondo.org',
+	)
+	appcmd('add apppool', name="Adams Row Tracker")
+	appcmd(['set', 'app', 'Adams Row Tracker/',
+		applicationPool="Adams Row Tracker"])
 	zip_safe=False,
 	install_requires=[
 		'roundup',
+		'pytz',
 	],
 	setup_requires=[
 		'hgtools',