#!/usr/bin/env python2
# coding: utf-8

import os
import sys


def _setup_environ():
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'idm.settings')

    # форсируем загрузку настроек
    from django.conf import settings

    settings.LOGGING
    from . import celery_app


def django_main():
    _setup_environ()

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)


def celery_main():
    _setup_environ()

    from celery.__main__ import main

    return main()
