Celery How to setup Celery with Django? Celery is an asynchronous task framework that can be used to perform long-running jobs required in the Django web application
Sentry How to integrate Sentry for Django and Celery? All developers want to write bug-free code and ship it to production. While developing on local we have stack trace to capture our errors and resolve them, but we don't have that privilege on a production server, then ultimately our end users will start experiencing bugs and we
NewRelic How to add User IP address to NewRelic transaction for Django? NewRelic out of the box would ignore collecting User IP, due to privacy concerns. But for a lot of web applications, it is important to capture user IP so that performance can be monitored by categorizing by different physical user IPs. To pass user IP to a transaction of the
NewRelic How to integrate New Relic (APM) to Django? Application Performance Monitoring (APM) is a must-have tool for any of the applications which are live for external users. I prefer using NewRelic as an APM for all of my applications. Before jumping into the installation please create a new account with NewRelic. Deliver more perfect softwareWork smarter and solve
Django How to create custom middleware in Django? The TLDR answer: * Create a file custom_middleware.py file in the same folder as where Django settings.py file is present * Add the following code in custom_middleware.py class CustomMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): print("custom middleware
NewRelic How to ignore certain endpoints in NewRelic APM in Django? The best way to ignore certain endpoints/api from NewRelic APM would be to tweak the NewRelic agent flag using a middleware from newrelic import agent class CustomMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): # Check if the current url needs to be
Django How to setup health check for Django projects in production? Once you have developed a web application, you would want to make sure that your service is up 24 x 7 and if for some reason the server goes down, then you would be notified. Here comes the use case of health checks for your website. If your application is
Ghost platform How to open links in New Tab in Ghost CMS The TLDR answer You know how important it is for your blog to keep users in your domain rather than sending to some other website, but still, there would be scenarios where you have to add links to other domains and your users will click those links. By default Ghost
Dev tools Top tools to improve your product life cycle When we are starting our career we feel learning to code is the most difficult part, with time we realize that writing code is the easiest part, but building scalable reliable systems is the toughest. I tell this to folks looking for advice, anyone can write code but the most
Django Learnings after using Django for 5 years The TLDR answer: * Even after 15 years, it is one of the best Frameworks in the market which can handle everything from rapid prototyping to a million request scale. * Truly stand by the motto - "The web framework for perfectionists with deadlines." * Best documentation when it comes to
Django When to use update_or_create in Django? The TLDR answer: If you have used get_or_create you must have had the thought of if there is any Django ORM that could update_or_create. Well, Django has the exact implementation which can either update the DB object if present, else it would create a new object.
Django How to check Django version? Django has built-in util that gives you the current Django version, get_version which I would suggest you use. But apart from that method, you can use any of the following commands from the python shell, where you have to install Django. >>> import django >>>
Django How to use get_or_create in Django? The TLDR answer This is one of those two query one command ORM methods. It would make a query to the database with the given where clause query and if not found then it will create a new entry in the table using the default values. It returns a tuple
Python Python top interview questions 2022 After working with python for so many years in the industry, I have curated a list of python interview questions for both freshers who are starting their careers and also for experienced developers who are applying for a senior position. I have tried to mark all my questions with relevant
Python Array vs List in Python The array is a vector containing homogeneous elements, i.e same data types. All the elements are saved in continuous memory location so it has a better performance to lists in python. One important thing here we have to remember is that while creating an array we have to import
Dev tools GIT for dummies If you are starting with git it is highly possible to be overwhelmed by all the commands you have to remember to work. I won't be explaining how you can install git and what is the need for git, rather jump into the commands which you need to
Django What is the difference between blank and null in Django? null=True would tell the underlying database that this field is allowed to save null. blank=True is applicable in the Django forms layer, i.e. any user is allowed to keep empty this field in Django form or Admin page. blank value is stored in the database.
Dev Hacks How to get an emoji domain for your website? Couple of years back I saw a weird domain printed on a marketing leaflet, it had emoji in the domain. The first impression I had– Such a blunder, how could the team not check the domain name before printing the leaflets and also now they are distributing it . After being
Django Featured Django Top Interview Questions 2022 After working with Django for 5+ years and taking numerous interviews, I have realised that the questions one can ask in Django Interview are very limited. I have been on both sides of the table and to be honest, there are just a handful number of questions that one can
Dev tools CURL for dummies After being in the industry for so many years, I always felt that the power of curl is something which was unexplored by me. Most of the time I end up using Postman. Though Postman is a great tool with all the curl features implemented, but there are few scenarios
Dev tools Linux Commands which we use daily Ask any developer, and you will hear the same, switch your OS to Linux/Unix-based platform and switch to a terminal to have a better coding experience. But what we all forget is to share how daunting the whole migration strategy was for most of us. I started using the
Django How to create Django admin with readonly permission for all users? The TLDR answer: We all have encounter situations when someone from the product team asks us to create a model dashboard. With Django admin page, this is just a few lines of code. But what about those scenarios when someone asks for access to a crucial table in the admin
MongoDB What is the select query equivalent in PyMongo/MongoDB native query? The TLDR answer: Coming from the SQL domain, you might stumble upon requirement of writing a select <field_1>, <field_2> from xyz in Mongodb. It might be a little tempting to not use select query, but try to avoid doing it, since it might be
Django How to update multiple fields in Django model efficiently? The TLDR answer: The first answer which you would get when you search django model update on google you would find the .update() Django ORM. While this is great, let us see few points about .update() queryset - * post_save, pre_save signals does not get triggered. While this might
Django How to use Base Model (Inheritance) in Django? The TLDR answer: Once you start creating a serious project in Django you would want to add created_at and updated_at to most of the models. That's when you realise you are not following the Don't Repeat Yourself(DRY) principle by copy-pasting the same field