DoesNotExist at /settings : Profile matching query does not exist

@login_required(login_url='signin')
def settings(request):

user_profile = Profile.objects.get(user=request.user)

  if request.method == 'POST':

        if request.FILES.get('image') == None:
            image = user_profile.profileimg
            bio = request.POST['bio']
            location = request.POST['location']

            user_profile.profileimg = image
            user_profile.bio = bio
            user_profile.location = location
            user_profile.save()

        if request.FILES.get('image') !=None:
            image = request.FILES.get('image')
            bio = request.POST['bio']
            location = request.POST['location']

            user_profile.profileimg = image
            user_profile.bio = bio
            user_profile.location = location
            user_profile.save()

return render(request, 'setting.html', {'user_profile' :user_profile})

This code will not run in my project please i need help to get through.

Let’s start with the basics then - which specific line of code is causing this error, and what do you think might be causing it?