Thanks. I am a Python user, trying to deploy my python project as a web app. Integrating Django with a react frontend has been a new step for me, when it comes to integrating something like dropzonejs. It's nice that your way shows just Django.
I did use Django clean up module before but learning simply rewriting delete method was good, nice as always and thanks. Next video will be interesting 👍
Great video. Thx. Looking forward to the next. Tried to upload images on S3 (via django -storages) , it works well but I can't delete an uploaded image from the bucket when the "user" wants to delete only the image(partial delete) but not the object (post) entirely.
17:42 can you make a dedicated video on how to serve static and media file in production using nginx server, also setting up a contabo object storage instead of aws as contabo is cheap and there's no videos on that.
What would be a good way to add multiple images to a dog, but not always either needing to add images or to have a limit, like for a gallery for that instance? Would it be making a model called images that has a foreign key to the dog? Then could you have the form for those images on the same creation form as the dog?
How do we save the images to a cdn? Eg I want users to upload a profile picture, how do they upload it and it gets converted to an image url on cloudinary?
Could you please give us some adivise concerning resizing of the uploaded images? I try to do it on the client side (js) but I'm not sure if it's the best option. I do want to check the user's data on my server side for the sake of validation. To resize the uploaded image in the view or in the save method of the model has a risk to create a bottleneck. May be to resize it with lambda function on aws? Thank you in advance.
Different ways to do this, you can resize in Django and save to your media storage (perhaps best done in a Celery task, or some asynchronous method). An AWS lambda function would work well if your resources are stored on S3.
@@bugbytes3923 Thank you. Would it be a problem in an inability to accept images as an argument in celery function. In a view, if form is valid I can bind uploaded file to a model instance, and save it applying resize process in the save method. But it's not the case in celery. Could you make a lesson about it in the feature, please.
Thank you! Okay so i have an image field model with a default value "default=default-images/category.jpg" so that each new category can have something set if a user doesn't upload an image rightaway. But the problem occures when i test and delete the category. Now that default image gets deleted, so each new category that is created without an image, now has that empty value. Is there a workaround, but without doing it conditionally in the template?
If I understand correctly - On the backend, you can prevent the deletion of the default image within the model's delete() function. In that function, check if the model that you're deleting has the image-field's filename set to that default image, and avoid deleting the file if so (you can still remove the category itself, of course). Otherwise, if NOT the default, you can then delete that file, as well as the model.
I am absolutely seething right now, Why do I just keep getting the "Could not find config for 'default' in settings.STORAGES." Absolutely stupid situation.
good video, it was quite helpful. I was looking for how to delete the /media/ files but when the avatar in the profile is updated. In case it helps anyone, do it like this: def save(self, *args, **kwargs): # Delete the old file before saving the new one try: this = Avatar.objects.get(id=self.id) if this.image != self.image: this.image.delete(save=False) except Avatar.DoesNotExist: pass super(Avatar, self).save(*args, **kwargs)
i dont know English but i can undrestand what you do, thats perfect course , thank you l
Thank you - I'm glad to hear that!
the dog indeed is amazing
great content ! Now we waiting for how to use static files in production.
Thanks. Will look into that one in a future topic!
Thanks. I am a Python user, trying to deploy my python project as a web app. Integrating Django with a react frontend has been a new step for me, when it comes to integrating something like dropzonejs. It's nice that your way shows just Django.
All of your content is amazing
Thanks a lot Padel!
great stuff , as always nice and clear , really understandable , these videos are always my go to... thank you
Thanks a lot!
I did use Django clean up module before but learning simply rewriting delete method was good, nice as always and thanks. Next video will be interesting 👍
Thanks for watching! Lots of different techniques in Django!
Can't wait for the next video : )
Thanks a lot for watching!
Helped me once again... Thank you stallone :)
Awesome haha - thanks!
so excited for the next video!
Thanks a lot!
Can't wait for the next one!
Thanks!
nice one you are really inspiring me in the world of django
Thanks a lot!
Very interesting tutorial thank you !
Thank you, thanks for watching!
Perfect tuto for me ! Thank you so much :)
You're welcome - thanks for watching! :)
Great video. Thx. Looking forward to the next. Tried to upload images on S3 (via django -storages) , it works well but I can't delete an uploaded image from the bucket when the "user" wants to delete only the image(partial delete) but not the object (post) entirely.
Thank you!
Interesting problem, I'll see if I can address that in a future video.
you are django hero
Thanks a lot 😂
Excellent.
Thank you!
So cool!
Thank you for watching!
This is so clearly presented 🙏Could you explain how to automatically reduce file size uploaded images?
Thank you very much! I can look into that one, along with resizing, in a future video!
super ❤❤❤❤❤❤ Thank You
Thanks a lot for watching!
Ammmmmazing content ❤
Thanks so much!
17:42 can you make a dedicated video on how to serve static and media file in production using nginx server, also setting up a contabo object storage instead of aws as contabo is cheap and there's no videos on that.
Greate Lesson
Thanks for watching!
What would be a good way to add multiple images to a dog, but not always either needing to add images or to have a limit, like for a gallery for that instance? Would it be making a model called images that has a foreign key to the dog? Then could you have the form for those images on the same creation form as the dog?
Thanks so much
You’re welcome, thanks for the view!
Good work.
Please show us how to host a website in bluehosy
Thnx.
You're welcome!
Thank you
Thanks!
How do we save the images to a cdn? Eg I want users to upload a profile picture, how do they upload it and it gets converted to an image url on cloudinary?
You showed me what not to do in production, but you didn't tell me what I should do in production. How do I server files in a production environment?
Could you please give us some adivise concerning resizing of the uploaded images?
I try to do it on the client side (js) but I'm not sure if it's the best option.
I do want to check the user's data on my server side for the sake of validation. To resize the uploaded image in the view or in the save method of the model has a risk to create a bottleneck. May be to resize it with lambda function on aws? Thank you in advance.
Different ways to do this, you can resize in Django and save to your media storage (perhaps best done in a Celery task, or some asynchronous method). An AWS lambda function would work well if your resources are stored on S3.
@@bugbytes3923 Thank you. Would it be a problem in an inability to accept images as an argument in celery function. In a view, if form is valid I can bind uploaded file to a model instance, and save it applying resize process in the save method. But it's not the case in celery.
Could you make a lesson about it in the feature, please.
Thank you! Okay so i have an image field model with a default value "default=default-images/category.jpg" so that each new category can have something set if a user doesn't upload an image rightaway.
But the problem occures when i test and delete the category. Now that default image gets deleted, so each new category that is created without an image, now has that empty value.
Is there a workaround, but without doing it conditionally in the template?
If I understand correctly - On the backend, you can prevent the deletion of the default image within the model's delete() function.
In that function, check if the model that you're deleting has the image-field's filename set to that default image, and avoid deleting the file if so (you can still remove the category itself, of course). Otherwise, if NOT the default, you can then delete that file, as well as the model.
@@bugbytes3923 Thank you, i will try that :)
Image upload field works in django admin but not working in template (I am not using django forms)
Where is front end part for submitting image?
Thanks
Hello, How can i change text lang for the fileinput?
It upload image to folder but not saving to mysql database. pls kindly asist
I am absolutely seething right now, Why do I just keep getting the "Could not find config for 'default' in settings.STORAGES."
Absolutely stupid situation.
i want to store large video files how i link cloud storage with django models
Use a FileField with django-storages to link the video to its cloud location.
Thank y
Thanks for watching!
Good Shit.
Cheers!!
Can you do a video on ORM relations@@bugbytes3923
28:45 yes, please make it.
How to serve in production environment?
I dont know why, when i want to runserver at 6:40 i have error: from forms import DogForm
ModuleNotFoundError: No module named 'forms'
Try: from .forms import DogForm
Note the dot in from of forms: .forms
To tell django the forms module is in the current app
@@bugbytes3923 I just realized it at the same time :)
But thanks a lot for your quick reply.
Now I'm afraid to fail
good video, it was quite helpful. I was looking for how to delete the /media/ files but when the avatar in the profile is updated. In case it helps anyone, do it like this:
def save(self, *args, **kwargs):
# Delete the old file before saving the new one
try:
this = Avatar.objects.get(id=self.id)
if this.image != self.image:
this.image.delete(save=False)
except Avatar.DoesNotExist:
pass
super(Avatar, self).save(*args, **kwargs)