What I'm trying to do is, when user uploaded the CSV file. I'm trying to do functionalities in pandas.
Django template
<form action="{% url 'upload-timeslot' %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
My view
def bulk_timeslot_upload(request):
if request.FILES:
import pandas as pd
csv = request.FILES['fileToUpload']
data = pd.read_csv(csv)
print(data)
return render(request, 'bulk-timeslot.html')
when i tried to read csv, running server getting exited. If I import pandas globally, server not even running.