django + vue tutorial would be the best for real. if you created a series like that i would be so motivated from you because your teaching style is the best ever. and I loved django and vue from the first time i used them.
If you're running Django 5.0 onwards you need to write: in base.html: {% load static %} in settings.py: MEDIA_URL = 'media/' MEDIA_ROOT = ( BASE_DIR/'media' ) Do NOT put a comma after 'media' in MEDIA_ROOT
The images are not showing in the URl. Even I followed the each line as copy cat....after failing twice but still the images. Are not showing even not the default one
I watched your vue.js tutorials,those were really awesome.Thank you for making such tutorials,and can you make some tutorials for how to use vue.js along with Django.
Should be able to find media at localhost:8000/media 1:30 Settings.py i. MEDIA_URL = '/media/' ii. MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 3:30 urlpattern +=......... 5:40 (models) thumb = ...............
Wondered if you are going to show a video upgrading your site to Django 2.0 ... Great videos! For instance django 2.0 uses 'path' where 'url' was used previously in the urls file...
If you have an error "expected str, bytes or os.PathLike object, not list", go to the settings py file and check that you dont have square brackets around MEDIA_ROOT.
thanks... just a question if anyone can answer me i will grateful. i have a problem that default image is not selected automatically if i don't chose a file and that generates an error although I specified thumb=models.ImageField(default='default.png', blank=True)? I can see in the video around time 9:00 when he tried to chose an image in the admin page , the default image was not there(same problem that i have). did he manually chose default.png for each article and then he change it? if so what is the point of using default image property. I even tried downloading the project from git hub and run it. I tried removing one of the articles image and then checked and there was no default image(same result that I have?). the other thing when you leave an article without an image you will get an error because thumb has no image although we set the property to blank=True? any help will be highly appreciated.
Images not showing for me in 2023. I installed pillow. I dont know how to show the image. My configuration is correct but its showing the broken image and alt text. Can somebody please help
What about private media that isn't statically served like that? I'm using Django as my backend with React and I only want the image to be accessible if it's "owner" is authenticated.
Awesome series. I came back to this lesson after i finished them all because i noticed front end uploads weren't working for me. Was always going to the default image. If i later go to admin i see there is no image uploaded.
some tutorial websites have dynamic number of images(screenshot of some implementation) and text body explaining those images...Each tutorial can require different number of images and text body...so how to achieve that?
Sir , I put the defaul image as 'default.png ' but the file i dumped was 'default.jpg' i have changed it and even migrated the changes but it remains default.png PLZ help
you have to change the image for tuples which were present before changing the field. After changing the field new tuples will have the latest default image
Can anyone explain to me how our upload is automatically going to the media folder is this something with Django that it automatically keeps the image files in the media folder or I'm am I not getting the logic here
I kept getting "no such column: articles_article.thumb" when trying to load the articles page and the admin articles page. Even after I did makemigrations like Shaun pointed out. I was racking my brain on how the thumb object wouldn't work here. It turns out, maybe this is a difference in the versions of Django, you have to run "python manage.py migrate" as well. That got it to work for me. I don't remember Shaun saying you had to run anything other than makemigrations in the tutorial. So if you're getting that problem like I did, that's the fix.
I'm stuck... I did everything as you (checked twice), and images are only server from the article folder, not from the root folder/media... I'm on 2.2.6.
in django 2 if anyone is facing TypeError: 'module' object is not callable. the fix is to add "from django.contrib.staticfiles.urls import staticfiles_urlpatterns, static" . Rather then from django.conf.urls import static
You can craete model to store only image with it's description etc. and then in your model where you want to have many images just add column: images = models.ManyToManyField('', models.on_delete=SET_NULL)
Download default.png: github.com/iamshaunjp/django-playlist/tree/lesson-17/djangonautic/media. Place image in media folder (not the assets folder) for example: C:\Users\Gary\project\python\django-playlist\djangonautic\media
I ran out into trouble when I try to view my uploaded video/audio files in media url. Can someone help me solve this ? Here's the link to the question. stackoverflow.com/questions/59298331/error-in-django-when-i-play-uploaded-media-files-through-media-url
django + vue tutorial would be the best for real. if you created a series like that i would be so motivated from you because your teaching style is the best ever. and I loved django and vue from the first time i used them.
Thank you Net Ninja! This specific feature is often overlooked in 90% of all tutorials.
If you're running Django 5.0 onwards you need to write:
in base.html:
{% load static %}
in settings.py:
MEDIA_URL = 'media/'
MEDIA_ROOT = (
BASE_DIR/'media'
)
Do NOT put a comma after 'media' in MEDIA_ROOT
Good looking out!
thank you
The images are not showing in the URl. Even I followed the each line as copy cat....after failing twice but still the images. Are not showing even not the default one
Best django tutorial in the planet. you didn't lie about this
I watched your vue.js tutorials,those were really awesome.Thank you for making such tutorials,and can you make some tutorials for how to use vue.js along with Django.
we really need that bro. django + vue
Should be able to find media at localhost:8000/media
1:30 Settings.py
i. MEDIA_URL = '/media/'
ii. MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
3:30 urlpattern +=.........
5:40 (models) thumb = ...............
Wondered if you are going to show a video upgrading your site to Django 2.0 ... Great videos! For instance django 2.0 uses 'path' where 'url' was used previously in the urls file...
@Kyng Gregory Yup, been using flixzone for since november myself =)
Really simple explanation. Thank you
If you have an error "expected str, bytes or os.PathLike object, not list", go to the settings py file and check that you dont have square brackets around MEDIA_ROOT.
thanks... just a question if anyone can answer me i will grateful. i have a problem that default image is not selected automatically if i don't chose a file and that generates an error although I specified thumb=models.ImageField(default='default.png', blank=True)? I can see in the video around time 9:00 when he tried to chose an image in the admin page , the default image was not there(same problem that i have). did he manually chose default.png for each article and then he change it? if so what is the point of using default image property. I even tried downloading the project from git hub and run it. I tried removing one of the articles image and then checked and there was no default image(same result that I have?). the other thing when you leave an article without an image you will get an error because thumb has no image although we set the property to blank=True? any help will be highly appreciated.
Images not showing for me in 2023. I installed pillow. I dont know how to show the image. My configuration is correct but its showing the broken image and alt text. Can somebody please help
Thank you brother, you did a great job!
What about private media that isn't statically served like that? I'm using Django as my backend with React and I only want the image to be accessible if it's "owner" is authenticated.
can you share source code please?
Awesome series. I came back to this lesson after i finished them all because i noticed front end uploads weren't working for me. Was always going to the default image. If i later go to admin i see there is no image uploaded.
Why you didn't specify pillow in the installed apps list of the setting file after installation? I'm confused because I thought this step is required
Which keyboard you were using here!? It a catchy sound when you type..
idk why, but image is not visible on the webpage after doing the above steps. Can someone help?
for python 3.8.2 with pycharm install the pillow with command given bellow.
python -m pip install --upgrade pillow
some tutorial websites have dynamic number of images(screenshot of some implementation) and text body explaining those images...Each tutorial can require different number of images and text body...so how to achieve that?
Sir , I put the defaul image as 'default.png ' but the file i dumped was 'default.jpg' i have changed it and even migrated the changes but it remains default.png PLZ help
you have to change the image for tuples which were present before changing the field. After changing the field new tuples will have the latest default image
can I use it in production mode? A lot of website says that it only works in development mode
I need help, someone can help me, I am getting this error "expected str, bytes or os.PathLike object, not tuple", I dont know what I do :(
Me too
@@AxmedShiimax Please remove the , in the end of the code in settings. if we put , it automatically takes as a tuple.
Thanks I got the same error and your answer was the solution
Thank u for this awesome video.
Can anyone explain to me how our upload is automatically going to the media folder is this something with Django that it automatically keeps the image files in the media folder or I'm am I not getting the logic here
I kept getting "no such column: articles_article.thumb" when trying to load the articles page and the admin articles page. Even after I did makemigrations like Shaun pointed out. I was racking my brain on how the thumb object wouldn't work here. It turns out, maybe this is a difference in the versions of Django, you have to run "python manage.py migrate" as well. That got it to work for me. I don't remember Shaun saying you had to run anything other than makemigrations in the tutorial. So if you're getting that problem like I did, that's the fix.
He says just that at 8:10 in the movie. He even mistypes it first so he has to do it twice =)
Ah, thanks so much. I must have missed that.
@@danielfurey3081 no worries, it happens. God knows I miss most of the details in anything I watch :D
hey please help me
The current path, media/images2.jpg, didn't match any of these.
pls give me a solution
I'm stuck... I did everything as you (checked twice), and images are only server from the article folder, not from the root folder/media... I'm on 2.2.6.
are u saying when you go to /media/ u get an error? or are u saying ur pictures are not showing up. Make sure to add default.png also
thanks alot bro :)
pls help why cant i display the images this time...it just pure white..
Image is appearing broken ??
And every time i select one image its copy with some extension is created.
You might be confused with url.py. We are adding the code in djangonautic/url.py. Not in articles/url.py.
The png files aren't displaying properly on the website. What should i do?
Have u got solnnn????
Hi THe Net Ninja, you know some way to hide or restrict access to the url '/ MEDIA /' files in Django
You can maybe use staff_member_required function, but what is the point from that
You're the best
Thank you Sir.Great tutorial but what if i want to upload a media file like mp4 etc and i want to display on my webpage how can we do that??
please share how did you upload videos to webpage?
Is it possible simply by changing jpg or any image extension to mp4?
Great man thanks, can you make a video of your setup tour :-p
The Image Is Not Being Showed In Django 3
@obet reyes can you give the last part is settings.py please
@obet reyes fine it's working now. i forgot to add .url in sytax and the correct is{{ article.thumnail.url}} == Correct
thank you !
exception value :
table articles_article has no column named thumb
Try deleting your migration files and then run the migration commands again
Bro how to add multiple images to this.
Hey .. Good video ..any tutorial for image gallary from youtube
brilliant
How can add video in django media
how to integrate youtube videos please let me know sir!!!
in django 2 if anyone is facing TypeError: 'module' object is not callable. the fix is to add "from django.contrib.staticfiles.urls import staticfiles_urlpatterns, static" . Rather then from django.conf.urls import static
love you man
Hakan Halil glad to hear it helped you :)
can u help me guys? i can't output the img. i did everything like in this tutorial but nothing happened((
what is the problem in detail
Yes I got the same tooo
The images are not showing there even not the default one
@@rishabhverma6619 i solved it somehow but i can't remember sorry😔😔😔 it was 6months ago😔
Can u share the github repository or something like that?!??
thx
github repository??
In the vid description!
can anyone help me.. how to upload and store multiple images for a single record in database?
Hi, I am also looking for ways like this, did you solve this?
You can craete model to store only image with it's description etc. and then in your model where you want to have many images just add column:
images = models.ManyToManyField('', models.on_delete=SET_NULL)
I hope adding videos is the same
default image is not displaying . what to do ???
Download default.png: github.com/iamshaunjp/django-playlist/tree/lesson-17/djangonautic/media. Place image in media folder (not the assets folder) for example: C:\Users\Gary\project\python\django-playlist\djangonautic\media
Helpppp
So no one here has an error in installing Pillow??
i do
I ran out into trouble when I try to view my uploaded video/audio files in media url. Can someone help me solve this ?
Here's the link to the question.
stackoverflow.com/questions/59298331/error-in-django-when-i-play-uploaded-media-files-through-media-url
hate it when my girlfriend magaes me a lot