Django and DRF
331 subscribers
98 photos
39 files
161 links
Purpose is sharing, spreading knowledge which is most related to the Django and Django Rest Framework(DRF)

You can find in here my
- Articles
- Projects with source codes
- Videos
and another useful stuffs
Download Telegram
F expression in Django.

This is cool expression to use where you send queries using the Django ORM to DB.
*You can use this expression to combine some fields in one Table and not takes many data from database.
Django Tutorial
I suppose this is best tutorial for Beginner because before one or two years I learned some languages like html, css, js, python, c++ in w3school.It is understandable, readable, short texts and more comfortable than another platforms.
👍1
Django Supported Versions
👍1
What do you think guys ?

Django Best Practices 🌟

📁 Organize Django settings with multiple files:

- Create a settings/ directory
- Include separate files for each environment:
-
base.py (common settings)
-
local.py (local dev settings)
-
staging.py (staging version)
-
test.py (test settings)
-
production.py (live server settings)

Is that true thought or no ?
Please write down your opinions in comment
If you want to use multiple database in django project you can do it, It is just amazing stuff.

First of all you should fill credentials of your second or third database in "DATABASES" key dict which is located in settings.py of django project, They are included ENGINE, NAME, USER, PASSWORD, HOST, PORT and Name of Database which is using by django orm for Queries For example they are may be second_db or third_db or somthing that you want.
So and after you do all things that we said above you can use db you added in your views with using statement to send queries, if you are saving something to db you can do: my_object.save(using="legacy_users")
through thi you can save one data to multiple db with moving like this:
p = Person(name="Fred")
p.save(using="first")
p.save(using="second")

There is one issue with using Multiple db
Django’s admin doesn’t have any explicit support for multiple databases - more
1
PythonAnyWhere has been supporting free virtual mashines to deploy web application or websites.

This guide might be useful for you to deploy Django application to production I suppose it will be easy to understand and you can run on prod in short time.
API Made Easy 🔥.pdf
18.8 MB
The simple Guide for the API principles.

1. HTTP Verbs:
* POST - send data to server to create resource
* GET - ...

2. HTTP Status Code:
* 1xx - Informational
* 2xx - Success

3. Response Headers:
* Content-Type - Specifies MIME type of the data in the response.
...
4. API Design:
* GraphQL - a query language and runtime for building APIs.
...
5. API Architectures

6. API Design Patterns

7. API Security

8. API Testing

...
Forwarded from ShukurDev (ѕнυĸυralι)
How to make Basic and Full-Text Search in the Django using PostgreSQL 🔎
Language: 🇺🇿

* Used Django queryset lookups.
* Created 1000 Posts to test with Faker package.
* Given information about SearchVector, SearchQuery, SearchRank and Practise on them.
* To have source code in Github Repo.

Article: link
LinkedIn: link
To get source code on Github: link
How to scale a website to support millions of users? We will explain this step-by-step.

The diagram below illustrates the evolution of a simplified eCommerce website. It goes from a monolithic design on one single server, to a service-oriented/microservice architecture.

Suppose we have two services: inventory service (handles product descriptions and inventory management) and user service (handles user information, registration, login, etc.).

Step 1 - With the growth of the user base, one single application server cannot handle the traffic anymore. We put the application server and the database server into two separate servers.

Step 2 - The business continues to grow, and a single application server is no longer enough. So we deploy a cluster of application servers.

Step 3 - Now the incoming requests have to be routed to multiple application servers, how can we ensure each application server gets an even load? The load balancer handles this nicely.

To read more link
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.
👍1🔥1
https://t.me/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 😅
🔥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
👍2🔥2
💡 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
👍2😁2