Example #1
0
def runserver():
	import fs, optparse, daemon
	from os.path import join, exists
	from base import enable_logging
	from config import SiteConfig
	from populate import populate
	from cached import cache_expander, wipe_sitelists

	options, remainder = server_options_parser.parse_args()

	apply_site_dirs(remainder)
	enable_logging(options)
	config = SiteConfig(options)

	wipe_sitelists(config.active_domain)
	populate(cache_expander,config)
	if options.fork:
		pid = os.fork()
		if pid == 0: 
			# The Child Process
			with daemon.DaemonContext():
				start_server(site.PROJECT_DIR,"runserver",config)
		else:
			print "Forked a Daemon as", pid
	else:
		start_server(site.PROJECT_DIR,"runserver",config)
Example #2
0
def populateserver():
	import fs, optparse
	from os.path import join, exists
	from base import enable_logging
	from config import SiteConfig
	from populate import populate, save_expander
	from cached import cache_expander, wipe_sitelists

	options, remainder = populate_options_parser.parse_args()

	apply_site_dirs(remainder)
	enable_logging(options)
	config = SiteConfig(options)

	if config["output"]:
		populate(save_expander,config)
	else:
		wipe_sitelists(config.active_domain)
		populate(cache_expander,config)