Exemple #1
0
class BasicManagerServer(PTMModule):
	def __init__(self, application, bind_address = None, port = None, *args, **kw):
		super(BasicManagerServer, self).__init__(*args, **kw)
		
		if bind_address is None:
			bind_address = "0.0.0.0"
		
		if port is None:
			port = 8081
		else:
			port = int(port)
			
		self.logger.info("running on %s:%s" % (bind_address, port))
			
		self.__application = application
		self.__server = ThreadingWSGIServer((bind_address, port), application)
		
	def serve_forever(self):
		self.__server.serve_forever()
		
	def get_manager(self):
		return self.__application.manager
	manager = property(get_manager)
	
	@property
	def application(self):
		return self.__application
Exemple #2
0
	def __init__(self, application, bind_address = None, port = None, *args, **kw):
		super(BasicManagerServer, self).__init__(*args, **kw)
		
		if bind_address is None:
			bind_address = "0.0.0.0"
		
		if port is None:
			port = 8081
		else:
			port = int(port)
			
		self.logger.info("running on %s:%s" % (bind_address, port))
			
		self.__application = application
		self.__server = ThreadingWSGIServer((bind_address, port), application)
Exemple #3
0
import os

#print "file:", __file__
#DJANGO_PROJECT_DIR = os.path.dirname(__file__)
#print DJANGO_PROJECT_DIR
#PARENT_DIR, DJANGO_PROJECT_NAME = DJANGO_PROJECT_DIR.rsplit(os.sep, 1)
 
#sys.path.append(DJANGO_PROJECT_DIR)
os.environ['DJANGO_SETTINGS_MODULE'] = 'djeagle.settings'

HOST = "0.0.0.0"
PORT = 8000

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

if __name__ == '__main__':
    from ngniutils.net.httplib.server.wsgi import ThreadingWSGIServer
    httpd = ThreadingWSGIServer((HOST, PORT), application)
    
    print 'Serving on port %s:%d' % (HOST, PORT)
    httpd.serve_forever()