# Path: salmon/core/server.py
# class SalmonHTTPServer(object):
# 
#     def __init__(self, host=None, port=None, debug=False, workers=None):
# 
#         self.host = host or settings.WEB_HOST
#         self.port = port or settings.WEB_PORT
#         self.workers = workers
# 
#         options = settings.WEB_OPTIONS or {}
#         gunicorn_args = [
#             '--bind={0}:{1}'.format(self.host, self.port),
#             '--timeout={0}'.format(options.get('timeout', 30)),
#             '--name={0}'.format(options.get('name', 'Salmon')),
#             '--workers={0}'.format(options.get('workers', 4)),
#             '--worker-class={0}'.format(options.get('worker', 'gevent'))
#         ]
# 
#         for bool_arg in ['debug', 'daemon']:
#             if options.get(bool_arg):
#                 gunicorn_args.append('--{0}'.format(options[bool_arg]))
# 
#         if workers:
#             '--workers={0}'.format(workers)
# 
#         self.gunicorn_args = gunicorn_args
# 
#     def run(self):
#         command = [os.path.join(settings.PYTHON_BIN, 'gunicorn'),
#                    'salmon.wsgi:application']
#         subprocess.call(command + self.gunicorn_args)


from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from optparse import make_option
from salmon.core.server import SalmonHTTPServer
import sys
            dest='debug',
            default=False),
        make_option('--noupgrade',
            action='store_false',
            dest='upgrade',
            default=True),
        make_option('--workers', '-w',
            dest='workers',
            type=int,
            default=None),
    )

    def handle(self, address=None, upgrade=True, **options):

        if address:
            if ':' in address:
                host, port = address.split(':', 1)
                port = int(port)
            else:
                host = address
                port = None
        else:
            host, port = None, None

        if upgrade:
            # Ensure we perform an upgrade before starting any service
            print "Performing upgrade before service startup..."
            call_command('migrate', verbosity=0)



# Path: salmon/core/server.py
# class SalmonHTTPServer(object):
# 
#     def __init__(self, host=None, port=None, debug=False, workers=None):
# 
#         self.host = host or settings.WEB_HOST
#         self.port = port or settings.WEB_PORT
#         self.workers = workers
# 
#         options = settings.WEB_OPTIONS or {}
#         gunicorn_args = [
#             '--bind={0}:{1}'.format(self.host, self.port),
#             '--timeout={0}'.format(options.get('timeout', 30)),
#             '--name={0}'.format(options.get('name', 'Salmon')),
#             '--workers={0}'.format(options.get('workers', 4)),
#             '--worker-class={0}'.format(options.get('worker', 'gevent'))
#         ]
# 
#         for bool_arg in ['debug', 'daemon']:
#             if options.get(bool_arg):
#                 gunicorn_args.append('--{0}'.format(options[bool_arg]))
# 
#         if workers:
#             '--workers={0}'.format(workers)
# 
#         self.gunicorn_args = gunicorn_args
# 
#     def run(self):
#         command = [os.path.join(settings.PYTHON_BIN, 'gunicorn'),
#                    'salmon.wsgi:application']
#         subprocess.call(command + self.gunicorn_args)


# Path: salmon/core/management/commands/start.py
from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from optparse import make_option
from salmon.core.server import SalmonHTTPServer
import sys

            dest='debug',
            default=False),
        make_option('--noupgrade',
            action='store_false',
            dest='upgrade',
            default=True),
        make_option('--workers', '-w',
            dest='workers',
            type=int,
            default=None),
    )

    def handle(self, address=None, upgrade=True, **options):

        if address:
            if ':' in address:
                host, port = address.split(':', 1)
                port = int(port)
            else:
                host = address
                port = None
        else:
            host, port = None, None

        if upgrade:
            # Ensure we perform an upgrade before starting any service
            print "Performing upgrade before service startup..."
            call_command('migrate', verbosity=0)



        server = SalmonHTTPServer(