Issue
my problem Here the image/file that the user uploaded aren't being displayed(They are being saved though!!) when I run the site using Terminal I get an error message on Terminal TypeError: serve() got an unexpected keyword argument 'document_root' but the site runs just fine. when I open my site on chrome it displays name of the image/file and only a symbol of an image/file but i want it to display the image/file it self not a symbol.
Setting.py:
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
( This only some part of the urls.py)
urls.py:
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
urlpatterns += static(settings.MEDIA_URL, documnet_root=settings.MEDIA_ROOT)
( This is also some part of the html file that displays the image)
file.html
{% if model.image %}
<image src="{{model.image.url}}">
{% endif %}
Solution
(moving comment to answer)
Just a typo:
documnet_root should be document_root
Answered By - Mike67
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.