Dev Hacks How to transfer files from EC2 to your local without ssh? One of the most common situations while working with remote servers is to transfer huge files from the remote server to our local machine for better debugging. We all have gone through the issue where you cannot directly ssh into the remote machine, i.e. you have some kind of
Django How to add a default 404 error page in Django? 404 is one of the most common errors for web applications to throw. But it is important to make sure that the end-user is not left hanging after a 404 error occurs, i.e. having no CTA (call to action) button available to the end-user. In the below example the
Python Show Output of shell command in realtime Python is a very powerful language that is used for automation. And a lot of times we create CLI tools using python. Python can be used to write a wrapper that would call Unix commands and we want to also see the output of those commands. Let us see how
Django How to query reverse foreign key relationship in Django queryset? TL;DR class Post(models.Model): content = models.TextField() class Comment(models.Model): comment_content = models.TextField() post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='comments_rel') created_at = models.DateTimeField(auto_add_now=True) # get all comments for a given post created in last 1 week last_
Python How to use a different delimiter for Python Template? Python template is a super powerful feature that can help you to fill the placeholders on the fly. But by default, the delimiter used by python for the template is a dollar $ , though this is perfect, at times you might need to use dollar in your final string and that
Django How to fix any Django Migration issue in local? Let us resolve any Django migration issue locally. Let us say you added a new field into the models.py file which caused the migration failure. The reason for migration failure can be anything, maybe a bad state of the database, or failure of old migration command, etc. I would
AWS How to add custom security groups to beanstalk? .ebextensions can help you attach custom security groups to the instance. Create a new security group, make sure to name the security group appropriately. You can add your custom inbound and outbound rules to the configuration. Let us name it demo-security-group, make sure to use the Security Group Name and
SailsJS How to open SailJS console in terminal? The biggest advantage of interpreter language is the use of a console. Be it Python or NodeJS, a developer can quickly open the shell and see execute snippets of the code. Once you start using the framework, suddenly the comfort of using a console goes away if the framework doesn't
Django How to render content with Context using Template in Django? Django template is a powerful built-in feature that most people on the modern web tend to overlook. Even I have myself overlooked this feature for more than 3 years into Django development, to finally embrace it with open arms. Let us first try to see how to render Β Context using
Docker Why should you learn docker? Gone are those days when you could be an expert of a certain language/framework and survive as a developer in the Industry. In today's fast-moving tech world, you are expected to be a problem solver. Companies want people who can understand the business problem and build a solution to
NodeJS How to work with multiple NodeJS versions using fnm? Working with multiple NodeJS projects can be challenging at times with different NodeJS version requirements. There are multiple tools that can help with working with multiple versions like nvmn fnm (My go-to approach which is performance and version oriented, for non docker projects)Docker (Always suggest going for docker setup,
Ghost platform How to add a comment feature to Ghost blogs? Comment is one of the most engaging feature for any blog. Ghost is one of the best blogging platforms with a great user experience, but unfortunately, it doesn't support any comment support out of the box. Though there are a few options that Ghost suggests they are mostly paid services
JavaScript How to upgrade all packages in JS or NodeJS? Javascript ecosystem is one of the finest and most evolving platform in the programming community. Hence you would find a lot of times the packages you have used in your project or in the global space get outdated soon. It becomes a task to then go and find out the
How to configure flake8 in Django? Code formatting and hygiene is one of the most crucial aspects of a project, this determines if all your fellow developers love to work on the codebase or they have a frustration look when a new task is given to them. How much so ever the senior folks in the
NodeJS How to make https POST request using native https package in nodejs? Native packages are one of the most performance oriented way to perform any task. While working with NodeJS one would encounter the most common task of making an HTTP request. There are multiple built-in packages and also third-party packages which can be used to do the same. Native httpsrequestaxiossuperagentgotOut of
AWS Cloudfront IP address list for all locations Using CDN would be one of the first pieces of advice which anyone would give when you want to improve the performance of your globally distributed users. CloudFront is the AWS CDN, which helps you integrate seamlessly into the AWS ecosystem. While using CloudFront you might come across one of
AWS Why does S3 take more time to upload after a few months of heavy usage? The TLDR answer:If you are using a flat structure(i.e. no directory inside bucket) to upload objects to the S3 bucket, then there you go that is the answer. I have worked with buckets that have 2M objects but in a flat structure taking almost 5x the time
Python What is __call__ in Python? Python exposes a lot of built-in methods which can help us override almost any operation with the objects. One of those methods is __call__ method. If we define a __call__ method then, it allows us to use the instance as a function. class Demo: def __init__(self): print('instantiated a
JavaScript How to remove/replace multiple occurrences of a particular word from a string? Find and replace is one of the most common use cases in IDE, but while writing code we would also come across use cases when we want to replace or remove a given set of characters from a string. JavaScript is a bit notorious in this regard, it can be
Ghost platform How to configure 301 redirect in Ghost CMS? When you start writing blogs on the Ghost CMS, you won't recognize that the URL for your blog gets picked up when you write the title for the first time, i.e. when you updated the title then the URL is not updated. This is a huge problem, why? A
NewRelic How to send logs from Django to NewRelic? Logs are one of the most important tools used to debug or get info on whether your systems are working on the track. Adding logs to a system is pretty easy, and especially if you are using Django, you can take advantage of the built-in logging framework. But the difficult
Dev Hacks How to google like a pro developer? Googling is one of the most underrated skills which experienced developers possess. Believe it or not, whether a coder is starting their career or 10 years into their career, they will always end up googling something or the other thing for their daily job. Let us now see quick tips
Celery How to perform healthcheck of Celery beat? Unpredictability or manual validation is the worst enemy of a developer.When we deploy any application to production our first hunch is to check if everything is working as expected. We start adding automatic health-check for all the systems in place so that we don't have to manually verify every
Django How to reload Django shell without restarting? Django shell is perhaps the first place where developers test their code and verify all the functionality. But we generally don't develop the whole code in the shell. most of the time we copy-paste the whole function and execute. Though this way of development is perfect for say 20-30 lines
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