Answer the question
In order to leave comments, you need to log in
Why are the photos not saved to a folder?
Photos are saved when you change them through the database. And when changes are made by the user on the site, they change in the database but are not saved to the static/images folder.
Settings.py:
STATIC_URL = '/static/'
MEDIA_URL = '/images/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
MEDIA_ROOT = os.path.join(BASE_DIR, 'static/images')
if request.method == "POST":
for i in isauthedbool:
if i.account_login == login_for_redirect:
redact_base = account.objects.get(account_login = i.account_login)
redact_base.account_image = request.POST['file']
redact_base = redact_base.save()
return render(request, "frontend/profile.html", {'isauthed_for_html': isauthed_for_html,'isauthedbool': isauthedbool, 'login_for_redirect': login_for_redirect})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question