I have an angular frontend app which send file to django backend which data 
is setting in django session. After I send a httprequest to django backend 
to make ML tratements on that data and get the results. But I've a 500 
sever error: keyerror 'ts_dataset_copy': KeyError: 'ts_dataset_copy'
[24/Feb/2020 18:43:46] "GET /cv_classification/5/FOTS/283/None/0/0 
HTTP/1.1" 500 78264. Here are my django code:

Firstly I upload timeseries dataset file from angular frontend (All thing 
is ok)    
@csrf_exempt
    def upload_local_dataset(request):
        if request.method == 'POST':
            dataset = pd.read_csv(request.FILES.get('datasetfilepath'), 
header=None, index_col=None)
            request.session['ts_datset'] = dataset.to_json(orient='values')
            request.session['ts_dataset_copy'] = dataset.to_json(orient=
'values')
    
            return HttpResponse(dataset.to_json(orient='values'))



# second httrequest that throws a server internal error

    def cv_classification(request, kfolds, dissimilarity_func, 
windows_length=0, noisy_law="", mu=0, 
    
        std=0):
            noisy_law = noisy_law.lower()
            df = pd.read_json(request.session['ts_dataset_copy'], orient=
'values')
            predictions = cv_classify(df, kfolds, dissimilarity_func, 
windows_length, noisy_law, mu, std)
            return JsonResponse(predictions, safe=False)



Thanks for your help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0636beca-4da4-4af2-9025-c6638e752722%40googlegroups.com.

Reply via email to