from django.http import HttpResponse from django.shortcuts import render, redirect from .forms import Model3DForm def index(request): return HttpResponse("Hello, this is the slicer app!") def index(request): return render(request, 'frontend/index.html') def upload_model(request): if request.method == 'POST': form = Model3DForm(request.POST, request.FILES) if form.is_valid(): model_instance = form.save() slicing_result = slice_model(model_instance.file.path) return render(request, 'slicing_result.html', slicing_result) else: form = Model3DForm() return render(request, 'upload.html', {'form': form}) def success(request): return HttpResponse('Successfully uploaded') def slice_model(file_path): # Placeholder for CuraEngine slicing logic return { 'estimated_time': '2 hours', 'material_used': '15 grams' }