# DoesNotExist at /settings : Profile matching query does not exist

**URL:** <https://forum.djangoproject.com/t/doesnotexist-at-settings-profile-matching-query-does-not-exist/16725>\
**Category:** Mystery Errors\
**Created:** [October 31, 2022, 5:37am UTC](https://forum.djangoproject.com/t/doesnotexist-at-settings-profile-matching-query-does-not-exist/16725 "2022-10-31T05:37:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlessingBot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/blessingbot/32/10622_2.png) [@BlessingBot](https://forum.djangoproject.com/u/BlessingBot)\
**Post date:** [October 31, 2022, 5:37am UTC](https://forum.djangoproject.com/t/doesnotexist-at-settings-profile-matching-query-does-not-exist/16725/1 "2022-10-31T05:37:17Z")

</div>

```auto
@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.
```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [October 31, 2022, 11:45am UTC](https://forum.djangoproject.com/t/doesnotexist-at-settings-profile-matching-query-does-not-exist/16725/2 "2022-10-31T11:45:34Z")

</div>

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?
