"""
WSGI config for server project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')

application = get_wsgi_application()

import inspect
from apps.ml.registry import MLRegistry
from apps.ml.income_classifier.random_forest import RandomForestClassifier

try:
    registry = MLRegistry()

    rf = RandomForestClassifier()

    registry.add_algorithm(endpoint_name="income_classifier",algorithm_object=rf,algorithm_name="random forest", algorithm_status="production", algorithm_version="0.0.1",owner="Piotr",algorithm_description="Random forest with simple pre and post processing",algorithm_code=inspect.getsource(RandomForestClassifier))
except Exception as e:
    print ("Error while loading algorithm to the registry",str(e))

[((14, 0, 14, 66), 'os.environ.setdefault', 'os.environ.setdefault', ({(14, 22, 14, 46): '"""DJANGO_SETTINGS_MODULE"""', (14, 48, 14, 65): '"""server.settings"""'}, {}), "('DJANGO_SETTINGS_MODULE', 'server.settings')", False, 'import os\n'), ((16, 14, 16, 36), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ({}, {}), '()', False, 'from django.core.wsgi import get_wsgi_application\n'), ((23, 15, 23, 27), 'apps.ml.registry.MLRegistry', 'MLRegistry', ({}, {}), '()', False, 'from apps.ml.registry import MLRegistry\n'), ((25, 9, 25, 33), 'apps.ml.income_classifier.random_forest.RandomForestClassifier', 'RandomForestClassifier', ({}, {}), '()', False, 'from apps.ml.income_classifier.random_forest import RandomForestClassifier\n'), ((27, 273, 27, 314), 'inspect.getsource', 'inspect.getsource', ({(27, 291, 27, 313): 'RandomForestClassifier'}, {}), '(RandomForestClassifier)', False, 'import inspect\n')]