# Path: salmon/core/runner.py
# def configure_app(**kwargs):
#     """Builds up the settings using the same method as logan"""
#     sys_args = sys.argv
#     args, command, command_args = parse_args(sys_args[1:])
#     parser = OptionParser()
#     parser.add_option('--config', metavar='CONFIG')
#     (options, logan_args) = parser.parse_args(args)
#     config_path = options.config
#     logan_configure(config_path=config_path, **kwargs)
# 
# def generate_settings():
#     """
#     This command is run when ``default_path`` doesn't exist, or ``init`` is
#     run and returns a string representing the default data to put into their
#     settings file.
#     """
#     conf_file = os.path.join(os.path.dirname(base_settings.__file__),
#                              'example', 'conf.py')
#     conf_template = open(conf_file).read()
#     default_url = 'http://salmon.example.com'
#     site_url = raw_input("What will be the URL for Salmon? [{0}]".format(
#         default_url))
#     site_url = site_url or default_url
#     secret_key = base64.b64encode(os.urandom(KEY_LENGTH))
#     api_key = base64.b64encode(os.urandom(KEY_LENGTH))
#     output = conf_template.format(api_key=api_key, secret_key=secret_key,
#                                   site_url=site_url)
#     return output


from salmon.core.runner import configure_app, generate_settings
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
"""
WSGI config for salmon project.

This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.

Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.

"""

configure_app(
        project='salmon',
        default_config_path='~/.salmon/conf.py',
        default_settings='salmon.settings.base',

# Path: salmon/core/runner.py
# def configure_app(**kwargs):
#     """Builds up the settings using the same method as logan"""
#     sys_args = sys.argv
#     args, command, command_args = parse_args(sys_args[1:])
#     parser = OptionParser()
#     parser.add_option('--config', metavar='CONFIG')
#     (options, logan_args) = parser.parse_args(args)
#     config_path = options.config
#     logan_configure(config_path=config_path, **kwargs)
# 
# def generate_settings():
#     """
#     This command is run when ``default_path`` doesn't exist, or ``init`` is
#     run and returns a string representing the default data to put into their
#     settings file.
#     """
#     conf_file = os.path.join(os.path.dirname(base_settings.__file__),
#                              'example', 'conf.py')
#     conf_template = open(conf_file).read()
#     default_url = 'http://salmon.example.com'
#     site_url = raw_input("What will be the URL for Salmon? [{0}]".format(
#         default_url))
#     site_url = site_url or default_url
#     secret_key = base64.b64encode(os.urandom(KEY_LENGTH))
#     api_key = base64.b64encode(os.urandom(KEY_LENGTH))
#     output = conf_template.format(api_key=api_key, secret_key=secret_key,
#                                   site_url=site_url)
#     return output


# Path: salmon/wsgi.py
from salmon.core.runner import configure_app, generate_settings
from django.core.wsgi import get_wsgi_application
from dj_static import Cling

"""
WSGI config for salmon project.

This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.

Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.

"""

configure_app(
        project='salmon',
        default_config_path='~/.salmon/conf.py',
        default_settings='salmon.settings.base',

        settings_initializer=generate_settings,