Hi guys.
Django Image Optimizer 🍏🍋🍊
This package is very useful to optimize image in your django projects and is simple to configure it.
It allows you optimization by images using TinyPNG or Pillow.
You can introduce with it in this link.
Django Image Optimizer 🍏🍋🍊
This package is very useful to optimize image in your django projects and is simple to configure it.
It allows you optimization by images using TinyPNG or Pillow.
You can introduce with it in this link.
PyPI
django-image-optimizer
Django Image Optimizer (Compressor)
👍1🔥1
https://t.iss.one/shukurdev/1055
In django in the one coolest case will might be used this method 🤩🥳
If you are gonna make SearchView for your project you have to search terms in the any of the models in the application and to do this you search objects by term and you had returned all of object types as separately untill now. So now with this method you will have chance to return results of the objects which you have searched as single keyword which is mean {"key": "value"}.
👆👆👆have showed example in the above image.
p.s: please write comments 😅
In django in the one coolest case will might be used this method 🤩🥳
If you are gonna make SearchView for your project you have to search terms in the any of the models in the application and to do this you search objects by term and you had returned all of object types as separately untill now. So now with this method you will have chance to return results of the objects which you have searched as single keyword which is mean {"key": "value"}.
👆👆👆have showed example in the above image.
p.s: please write comments 😅
🔥1
Use select_for_update() method in Django when you have problem with concurrency.
Agar sizda bir vaqting uzida bir nechta process ni ishga tushirishda muammo bulayotgan bulsa shu method dan foydalanganingiz maqul chuni bu bir process ni yakunlab bulgunicha usha process ni lock qilib turadi va keyin ikkinchi process ga ruhsat beradi.
Link: https://www.sankalpjonna.com/learn-django/managing-concurrency-in-django-using-select-for-update
Agar sizda bir vaqting uzida bir nechta process ni ishga tushirishda muammo bulayotgan bulsa shu method dan foydalanganingiz maqul chuni bu bir process ni yakunlab bulgunicha usha process ni lock qilib turadi va keyin ikkinchi process ga ruhsat beradi.
Link: https://www.sankalpjonna.com/learn-django/managing-concurrency-in-django-using-select-for-update
Sankalpjonna
Managing concurrency in Django using select_for_update
A tutorial on how one can use select_for_update to lock a Django queryset until the transaction it is in is committed in order to handle concurrency.
👍2🔥2
Django and DRF
Deploying 1. https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04
👆👍👏💡 This is very useful guide to deployment process
💡 Django Celery Beat is the best package to store tasks which can done as automatically on database. And you can manage all of saved tasks on Django Admin panel and you can create, edit and delete tasks and how often they should run with Periodic Tasks
🫐Pypi package
🍉Source
🫐Pypi package
🍉Source
PyPI
django-celery-beat
Database-backed Periodic Tasks.
👍2😁2
Javascript dasturchisi Python code yozsa qanday bularkin deydiganlar uchun Top🍉 examples 🥳
Va bu code ni review qilayotgan men: 😰🥵🤯🤬
P.S: Qanday tilda kod yozsangiz ham har bir tilni uzini qonun qoidalari asosida yozishga harakat qiling please. Sizdan keyingi keladigan dasturchilarni ham ozgina o'ylang, f***, b** kabi so'zlarni eshitmay desangiz 😎
Va bu code ni review qilayotgan men: 😰🥵🤯🤬
P.S: Qanday tilda kod yozsangiz ham har bir tilni uzini qonun qoidalari asosida yozishga harakat qiling please. Sizdan keyingi keladigan dasturchilarni ham ozgina o'ylang, f***, b** kabi so'zlarni eshitmay desangiz 😎
🤣1
Deploy web applications which is made with django on the Render.
https://testdriven.io/blog/django-render/
https://testdriven.io/blog/django-render/
testdriven.io
Deploying a Django App to Render
This tutorial looks at how to deploy a Django application to Render.
In some cases django devs have one problem with migrations files, so i think the guy who is first met with this issue is gonna delete all of migrations and data in DB. if he does this in the production he will might lost all real data 😰🥴🥶.
Ok WHAT SHOULD IT DO ???
Django has — fake flag which is written with migrate command together like this: python manage.py migrate —fake
It tells to Django that migrations have already applied and not need to run it(DON'T RUN IT).
Actually it creates a row in django_migrations table but not run in the SQL to change table structure.
In one another case if you have multiple migrations file you can delete all of them and use above flag(argument).
Ok WHAT SHOULD IT DO ???
Django has — fake flag which is written with migrate command together like this: python manage.py migrate —fake
It tells to Django that migrations have already applied and not need to run it(DON'T RUN IT).
Actually it creates a row in django_migrations table but not run in the SQL to change table structure.
In one another case if you have multiple migrations file you can delete all of them and use above flag(argument).
🔥 I absolutely recommended reading this article to learn more about object serializing way and you realize that which way is the best to serialize in short time.
https://hakibenita.com/django-rest-framework-slow
https://hakibenita.com/django-rest-framework-slow
Devops haqida bu saytdagi🍊 maqolalar juda yaxshi yozilyapti uzbek tilida 😍
Github actions haqida: https://devops-journey.uz/guides/ci-cd/github-actions-ci-cd.en-UZ
Github actions haqida: https://devops-journey.uz/guides/ci-cd/github-actions-ci-cd.en-UZ
devops-journey.uz
Asosiy - DevOps Journey
DevOps bo'yicha bepul ta'lim platformasi bo'lgan DevOps Journey-ga xush kelibsiz
Backend Dasturchilar uchun 10 ta eng muhim operatsion tizim konseptsiyasi.
https://masteringbackend.com/posts/the-10-operating-system-concepts-for-backend-developers
https://masteringbackend.com/posts/the-10-operating-system-concepts-for-backend-developers
Mastering Backend
The 10 Operating System Concepts for Backend Developers
This lesson will explore important concepts to learn in operating systems as a backend engineer.
👍2
⏩⏩ Nima uchun Django loyihani serverga joylayotganimizda gunicorn servisidan foydalanamiz ?, Django runserver dan foydalanish mumkinku !?
Bu yangi dasturchilar orasida juda ko'p so'ralgan savol
Bu yerda mening tushuncham:👇
⛔️ Djangoning runserveri Single-Thread:
Ko'p qatorli avtomagistraldan farqli o'laroq, runserver - bu bitta qatorli yo'l ga o'xshaydi. U bir vaqtning o'zida faqat birgina so'rovni tutib(handle) qolishi mumkin, bir vaqtning o'zida bir nechta so'rovlar kelganda navbatlarning paydo bo'lishiga olib keladi. Bu userlar yuqori trafik ostida qolib, javob olish vaqtlari sekinlashishiga olib keladi.
✅ Enter Gunicorn: The Concurrency Hero 💪
Gunicorn production muhitida:
✅ Concurrent Processing: Gunicorn ishchi processlarini yaratadi, har biri mini-django app sifatida ishlaydi. So'rovlar yetib kelgan vaqtda, Gunicorn ishchilarni(workers) bo'lib tashlaydi, processlarga parallel ravishda ishlashga imkon beradi. Va bu sezilari darajada performance ni oshishiga tasir qiladi, ayniqsa og'ir trafik ostidagilar uchun.
✅ Scalability: Gunicorn da trafik talablaringizga mos worker processlarning sonini sozlab quyish mumkin.Bu avtomagistrallarga eng tirband bo'lgan vaqtda qo'shimcha yo'llar qo'shishga o'xshaydi
✅ Production-Ready Features: Gunicorn real loyihalarning deployment jarayoni uchun muhim hususiyatlarni taqdim qiladi, ya'ni quyidahilar:
🔹 Pre-forking - so'rovlarni samarali handle qilish uchun worker proccesslarni qayta ishlatish.
🔹 Ilovani restart qilmasdan uning code larni muammosiz o'zgartirish uchun juda zo'r Reloading.
🔹 Timeouts va workerlarni samarali monitoring qilish scaling uchun.
🔹 Yuqori darajadagi loggin va errorlarni handle qilish kuzatishni yaxshilash uchun.
Gunicorndan foydalangan holatda, siz Django loyihangizni samarali scale qila olasiz, so'rovlarni parallel ravishda handle qilish, va foydalanuvchiga muammosiz yetkazib berish – hatto yuqori o'lchamdagi traffic bo'lgan taqdirda ham.
Bu yangi dasturchilar orasida juda ko'p so'ralgan savol
Bu yerda mening tushuncham:👇
⛔️ Djangoning runserveri Single-Thread:
Ko'p qatorli avtomagistraldan farqli o'laroq, runserver - bu bitta qatorli yo'l ga o'xshaydi. U bir vaqtning o'zida faqat birgina so'rovni tutib(handle) qolishi mumkin, bir vaqtning o'zida bir nechta so'rovlar kelganda navbatlarning paydo bo'lishiga olib keladi. Bu userlar yuqori trafik ostida qolib, javob olish vaqtlari sekinlashishiga olib keladi.
✅ Enter Gunicorn: The Concurrency Hero 💪
Gunicorn production muhitida:
✅ Concurrent Processing: Gunicorn ishchi processlarini yaratadi, har biri mini-django app sifatida ishlaydi. So'rovlar yetib kelgan vaqtda, Gunicorn ishchilarni(workers) bo'lib tashlaydi, processlarga parallel ravishda ishlashga imkon beradi. Va bu sezilari darajada performance ni oshishiga tasir qiladi, ayniqsa og'ir trafik ostidagilar uchun.
✅ Scalability: Gunicorn da trafik talablaringizga mos worker processlarning sonini sozlab quyish mumkin.Bu avtomagistrallarga eng tirband bo'lgan vaqtda qo'shimcha yo'llar qo'shishga o'xshaydi
✅ Production-Ready Features: Gunicorn real loyihalarning deployment jarayoni uchun muhim hususiyatlarni taqdim qiladi, ya'ni quyidahilar:
🔹 Pre-forking - so'rovlarni samarali handle qilish uchun worker proccesslarni qayta ishlatish.
🔹 Ilovani restart qilmasdan uning code larni muammosiz o'zgartirish uchun juda zo'r Reloading.
🔹 Timeouts va workerlarni samarali monitoring qilish scaling uchun.
🔹 Yuqori darajadagi loggin va errorlarni handle qilish kuzatishni yaxshilash uchun.
Gunicorndan foydalangan holatda, siz Django loyihangizni samarali scale qila olasiz, so'rovlarni parallel ravishda handle qilish, va foydalanuvchiga muammosiz yetkazib berish – hatto yuqori o'lchamdagi traffic bo'lgan taqdirda ham.
🔥8
#savol
Access tokenni yaroqlilik muddatini 2 3 yil qilsam ham boladimi. 😢
javob:
haa bo'ladi, lekin bu holatda havfsizlikni o'ylamasangiz ham bo'ladi chunki agar hujum qilishmoqchi bo'lsa 1 2 kunda dasturizni qo'lga olishi mumkin. token dan foydalanmasangiz ham bo'ladi😁 agar 2 3 yil qilmoqchi bo'lsangiz chunki foydasi tegmaydi baribir.
Access tokenni yaroqlilik muddatini 2 3 yil qilsam ham boladimi. 😢
javob:
haa bo'ladi, lekin bu holatda havfsizlikni o'ylamasangiz ham bo'ladi chunki agar hujum qilishmoqchi bo'lsa 1 2 kunda dasturizni qo'lga olishi mumkin. token dan foydalanmasangiz ham bo'ladi😁 agar 2 3 yil qilmoqchi bo'lsangiz chunki foydasi tegmaydi baribir.