I have a very simple web app for uploading CSV files to my server. For that purpose, I'm using AJAX and JQUERY under DJANGO:
function Upload_Bonds(){
var csrftoken = getCookie('csrftoken');
var formData = new FormData(document.getElementById("formUploadBonds"));
var add_answer = confirm("Confirm uploading and processing of csv File?" );
if (add_answer) {
$.ajax({
url: "/cvs/DealStore/upload_bonds/",
type: "POST",
data: formData,
async: false,
cache: false,
contentType: false,
enctype: 'multipart/form-data',
processData: false,
success: function (data) {
$('#message').html("<p class='text-center text-success font-weight-bold'>Success</p>");
window.alert("Data populated, please check the Bonds list table!");
},
error: function(data) {
$("#message").html("<p class='text-center text-danger font-weight-bold'>Failed</p>");
}
});
}
}
However, every time I try to use the function, I'm receiving POST 500 (Internal server error). I was able to capture the following on the browser console:
Any idea about how to handle this error? I deployed the app on another server and works fine. So maybe is something about server configuration. (I'm using Linux servers)
Thanks!