# Path: hubcave/utils/runner.py
# def configure():
#     configure_app(
#         project='hubcave',
#         default_config_path='~/.hubcave/settings.py',
#         default_settings='hubcave.core.settings.base',
#         settings_initializer=generate_settings,
#         settings_envvar='HUBCAVE_CONF',
#     )
# 
# Path: hubcave/game/management/commands/runserver_socketio.py
# def run_socket_server(addr, port, *args, **options):
#     bind = (addr, int(port))
#     print
#     print "SocketIOServer running on %s:%s" % bind
#     print
#     handler = get_handler(*args, **options)
#     server = SocketIOServer(bind, handler,
#                             heartbeat_interval=5,
#                             heartbeat_timeout=30,
#                             resource="socket.io",
#                             policy_server=True)
#     server.serve_forever()
# 
# def get_handler(*args, **options):
#     """
#     Returns the django.contrib.staticfiles handler.
#     """
#     handler = WSGIHandler()
#     try:
#         from django.contrib.staticfiles.handlers import StaticFilesHandler
#     except ImportError:
#         return handler
#     use_static_handler = options.get('use_static_handler', True)
#     insecure_serving = options.get('insecure_serving', False)
#     if (settings.DEBUG and use_static_handler or
#             (use_static_handler and insecure_serving)):
#         handler = StaticFilesHandler(handler)
#     return handler


import os
import os.path
import sys
from thread import start_new_thread
from hubcave.utils.runner import configure
from hubcave.game.management.commands.runserver_socketio import run_socket_server, get_handler
from django.core.wsgi import get_wsgi_application


# Add the project to the python path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
sys.stdout = sys.stderr

# Configure the application (Logan)
configure()



start_new_thread(run_socket_server, ("0.0.0.0", "8018"))

# Path: hubcave/utils/runner.py
# def configure():
#     configure_app(
#         project='hubcave',
#         default_config_path='~/.hubcave/settings.py',
#         default_settings='hubcave.core.settings.base',
#         settings_initializer=generate_settings,
#         settings_envvar='HUBCAVE_CONF',
#     )
# 
# Path: hubcave/game/management/commands/runserver_socketio.py
# def run_socket_server(addr, port, *args, **options):
#     bind = (addr, int(port))
#     print
#     print "SocketIOServer running on %s:%s" % bind
#     print
#     handler = get_handler(*args, **options)
#     server = SocketIOServer(bind, handler,
#                             heartbeat_interval=5,
#                             heartbeat_timeout=30,
#                             resource="socket.io",
#                             policy_server=True)
#     server.serve_forever()
# 
# def get_handler(*args, **options):
#     """
#     Returns the django.contrib.staticfiles handler.
#     """
#     handler = WSGIHandler()
#     try:
#         from django.contrib.staticfiles.handlers import StaticFilesHandler
#     except ImportError:
#         return handler
#     use_static_handler = options.get('use_static_handler', True)
#     insecure_serving = options.get('insecure_serving', False)
#     if (settings.DEBUG and use_static_handler or
#             (use_static_handler and insecure_serving)):
#         handler = StaticFilesHandler(handler)
#     return handler


# Path: hubcave/wsgi.py
import os
import os.path
import sys
from thread import start_new_thread
from hubcave.utils.runner import configure
from hubcave.game.management.commands.runserver_socketio import run_socket_server, get_handler
from django.core.wsgi import get_wsgi_application



# Add the project to the python path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
sys.stdout = sys.stderr

# Configure the application (Logan)
configure()



start_new_thread(run_socket_server, ("0.0.0.0", "8018"))

application = get_wsgi_application()