By using our website, you agree to our privacy policy

Ruddra.com

Reduce Build Time for Docker Image with Data Science Packages

If you want to use data science packages like numpy, scipy, pandas etc with your docker container and using pip to install them, then it will take forever to build the images. Because pip compiles the C extended code and that compilation needs a lot of …

Create an Application with JWT based Authentication in 10 Minutes using Django

Let us say, you need an authentication service in a rush, which needs to be cutting edge and uses JWT based authentication. Or you need a stand alone authentication service to be plugged in with other microservices. Do not worry, you can create one in 10 …

Run a Build in AWS CodeBuild When a Git Tag is Pushed

AWS CodeBuild has nice integration with different Git repository hosting service providers(like GitHub, BitBucket, even amazon’s own CodeCommit etc). Even using WebHook is pretty easy. You can start a build in CodeBuild for every push, pull, PR …

Hugo: Use Environment Variable in Markdown Files

Hugo is a fantastic framework to generate static site from markdown and serve them. Using environment variables in templates is a breeze but using them in markdown files can be a bit tricky. You need to use custom shortcodes as workaround to resolve this …

Capstone Project: Find Best Neighborhood to Fight Pandemic in NYC

Disclaimer: this article has been generated as part of IBM Data Science Professional Certificate course’s final submission. This is the report of the project for IBM’s Data Science Professional Certificate on Coursera. Table of contents ︎ Business …

Hugo: Deploy Static Site using GitHub Actions

If you are using Hugo to generate static pages, you are familiar with CLI commands which are to build the static pages in your local machine and make push to your <username>.github.io repository. When it comes to using Hugo for blogging, compared to …

Ship Application with Database Inside Docker Container

DISCLAIMER: This is not the recommended process. Ideally you should have the database running in a separate container and use network to interact with that container. Usually, we don’t ship application with the database inside the same container. But …

Maintain Authentication Layer from Redux Middleware Using React Router

Maintaining authentication layer in ReactJS can be painful. Back in the old days(even now-a-days), you needed to override every componentDidMount method in class based components to see if the user is authenticated. In the latest ReactJS, there are …

Use Docker for Accessing Database in AWS CodeBuild

AWS CodeBuild is an extraordinary tool for building your code. Recently I have been using it to build projects and store docker images in AWS ECR. During those CodeBuild processes, I needed Database for running tests. As the need of the Database was for a …

Basic Networking in Docker

We already know that Docker is used for containerization. But networking in docker makes it even better tool for deployment. You can make standalone deployments in containers and communicate between them, or make containers act as host, or even assign mac …

Implement Newsletter Subscription Using Staticman

In this article, I am going to share how you can set up a newsletter subscription using Staticman. No need to use third party newsletter subscription services. Collecting data in static sites or serverless sites(with POST request) is a hassle because you …

Tips on Using Volume, Entrypoint and Ignore Files in Docker

Have you worked with Docker before? Do you think you have trouble with it, like when you are developing an application, you need to build every time to see the results, or thinking of the best way to load data in DB, or may be you are annoyed because there …

Tips on Using Docker Compose, Build Argument and Environment Variable

Imagine, you have some microservices and you want to use API from one service to another, how can you do that if all of them are running in different docker container? Docker Compose has a solution for you. Suppose you want to deploy a project in test, …

Tips on Writing Dockerfile, Reduce Sizes and Build Time of Docker Image

For the past couple of years, I have been creating Dockerfile for different projects. based on those experiences I am going to share some tips on writing docker files to communication between containers. _FYI: before reading this article, please read the …

Manjaro KDE Virtual Desktop Management and Visual Improvement Shortcuts

For the past couple of days, I am testing out Manjaro linux. Most of the time, I was working with KDE Plasma Edition. In my opinion, it is the most beautiful desktop environment from Manjaro official distributions. I am a fan of Ubuntu Unity workspaces and …

Manjaro Tips and Tricks

Recently I tried out Manjaro operating system, and did some experiment with XFCE and KDE desktop environments. Here I am going to share some tips and tricks to setup Manjaro in you machine. This article is part of a series based on Manjaro. Tips shared …

Django Access URL Arguments Through Middleware

Lets say you have an API which is being used by many stores. Now for a specific store ABC, they want to have a different response format. So how would you make this implementation generic without making different views for store ABC? Simple, use …

Build and Configure Plugins Inside Solr Using Docker

Adding a plugin to Solr is relatively simple process. In this article, we are going to see how to add a plugin by creating a jar file using a docker container, then add that to a Solr which also runs inside docker container. Table of contents ︎ Building …

Use VS Code Inside Docker Container for Development

VS Code is the most popular IDE at the moment. You can use it for developing applications in almost any programming language. In addition to that, you can do remote development in Docker,VM etc. In this post, we are going to discuss about how to use Docker …

Django Serialize ForeignKey, ManyToMany, Instance, Property Method

Django’s serialization framework provides a mechanism for “translating” Django models into other formats. Usually they are in json, yaml, XML, GeoJSON etc text based formats. Here, we are going to supercharge these serializers to do more things, even try …

Deploy Django App in Sub Directory Using OpenShift

When you are using OpenShift, you will be using routes to expose a route from a service. Let’s say you want to expose a path in example.com/dummy. When you do that for a django application(without any reverse proxy server), it usually becomes a …

Install MySQL and MySQLClient(Python) in MacOS

Connecting to MySQL from Python in MacOS is a very problematic and painful process. In this post, we are going to see how to install MySQL and connect a Python application to it using mysqlclient. Table of contents ︎ Step one: install Homebrew Step two: …

Create Proxy Object in Python

Lets say you have been using a class named ClassA, objects created from that class has been used in many places. Now you have a requirement that you need to make a simillar class ClassB, which has almost simillar functionality. Objects of ClassA and ClassB …

Do Extra in S3 Using Django Storage and Boto3

Today, I am going to write about few useful snippets/functionalities which I have used for Amazon S3 or any S3 compitable storage using Boto3 and Django Storage. FYI, this post focuses on using S3 with Django. So without further ado, let us begin. Table of …

Django: Save Unknown Object in Database

Suppose you are dealing with a poorly written API, which returns different type of objects at different scenarios. For example, sometimes it returns a string(ie. abcd), sometimes it returns a list(ie. [1,2,3,4]), or maybe None. Now, you are suppose to save …

Django: Ordering by Linked List for Model Objects

Linked list is a data structure where each object has points to next. In django, linked list can provide an interesting solution when it comes to custom ordering/grouping issues. Lets think of an example like this= you are making a blog site, and you have …

Django: Changing User Model in Mid-Project

Every now and then I see some questions pop up in StackOverflow with title: ValueError: Related model ‘app.User’ cannot be resolved This is a very common issue and pops up when the user tries to run the migration. So, lets talk more about …

Testing for Django Rest Framework with Factory Boy and Faker

“I’m not a great programmer; I’m just a good programmer with great habits.” ― Kent Beck Test Driven Development - in short TDD is a practice where you write the tests first then the actual code. It makes the code less vulnerable and it makes a …

Bye Bye Ghost, Hello Hugo

“The Only Thing That Is Constant Is Change -” ― Heraclitus This blog site has changed quite a lot since the begining. I initially developed it as a Django application. It was part of my learning process, and I hosted it in a private shared server. But …

Control Application Flow from Redux Middleware using React Router 4

While developing application in ReactJs with Redux and React Router 4, what I felt is that, there is no direct relationship between application’s state and routing. We needed to create those connections inside Components. In each component, we needed …

Migration From Ghost 1.25.2 to 2.2

This post is no longer valid as I have moved to Hugo 😄 Table of contents ︎ Verdict Verdict I have just migrated the site from Ghost 1.25.2 to 2.2. As every growth comes with some inevitable pain, thus you can expect a lot of things are broken.

Automated Deployment to OpenShift Using Jenkins and Webhook

The last post was about defining the pipelines. Now it is time to execute them. Also, at the end, we are going to show how to integrate webhook in your repository, so that for a specific event(like Push, Pull request merge etc) it will trigger the …

Writing Jenkins Pipeline For OpenShift Deployment

Pipeline is a set of instructions, which will be executed as per given sequence and produce a output. Jenkins Pipeline is simply writing these instructions in Jenkins. These pipelines can be written in Groovy. In previous post we have defined deployment …

Deploy A Python App to OpenShift: Planning and Preparations

Deploying a Python application to OpenShift is fairly easy. Write a Dockerfile and run oc new-app /path/to/Dockerfile, that’s it!! But if you want implement a full fledged modern CI/CD using Jenkins and openshift, you need to do little more than …

Deploy Django to OpenShift Using Jenkins Pipeline(CI/CD)

Using Jenkins pipeline, you can easily automate your deployments in openshift. In this post, we are going to use this powerful tool to deploy a Django project. But before we start, one thing I need to mention is that, this project has been tested on in …

Boilerplate For Angular 1.X and Django(Powered by Webpack2, Docker, Yarn, DRF)

This post is deprecated. Use it at your own risk Simple and clean boilerplate for using django and angular 1.x togather, with basic structure comes built-in. Table of contents ︎ Tech Stack Prerequisite Setup frontend Setup docker Setup backend Usage …

Migration from Ghost 0.11 to 1.XX Using Docker

Ghost had formulated lots changes when they released version 1.XX. So, when you try to upgrade from 0.11 to 1.XX, you can follow the following steps. Table of contents ︎ Steps Export backup Rename old content Copy to a seperate directory Create cocker …

[Travel] Bandarban: In Search of Waterfalls

Bandarban is a heaven for trekking for Bangladeshi people. There are lots of hills around the district, and there are some amazing waterfall as well. I visited three amazing waterfalls named Nafakhum, AmiaKhum, Satbhaikhum. Khum means waterfall in Marma …

[Travel] Bandarban: Journey to Keokradong

Bandarban is a beautiful district of Bangladesh. You will see lots of amazing mountains which are part of Arakan range. Keokradong is the 3rd highest pick**(after Tajingdong and Saka Haphong, references are here) of Bangladesh, which is situated in …

[Travel] Journey to the Land of Thunder Dragon

I went to Bhutan on September, 2015. It was my best trip ever, really ever. From Dhaka, we went there by DRUK AIR. We(me and two of my friends) landed in Paro Airport. It was really wonderful airport, it was small but clean and organised. After getting out …

Deploy Django to OpenShift 3 Powered by MySQL and Gunicorn

If you want to use OpenShift for deploying Django, you can follow this post and simply do that. You don’t need to learn Kubernetes. We will use docker file only. No other fancy stuff. Also, before starting, I am also hoping you are little bit …

Use VS Code for Python and Django Development

Visual Studio Code is an editor developed by Microsoft. I have been using this editor for Python development for sometime now. Previously I have been using PyCharm Community Edition for development, but I had to switch to an editor which was less resource …

Ubuntu Hacks: Launching Chrome Apps at Startup

Chrome apps are really handy when you don’t want to overhaul your system with apps for every little purpose. Starting those apps at startup can be used instead of manually starting them every time you want to use them. Like starting the messenger at …

Play With Pillow

Who hasn’t heard PIL? It’s an image processing library made by python (Python Image Library). Pillow is an extension of it. Table of contents ︎ Installation Resize image Crop image in box shape Resize image and crop in center to convert it to …

Python: Selenium with PhantomJs to capture Screenshots

This article is deprecated as PhantomJs has been deprecated from Selenium as driver. PhantomJS is a headless WebKit script-able with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and …

Documentation Of Django Encrypt File

This is no longer maintained. Use it at your own risk. Django Encrypt File is a simple Library which can be used to encrypt uploaded files and store them. Table of contents ︎ Installation Basic usage Using in the view Advance example(with models) Model …

Docker: Use Celery in Django(Redis as Broker)

In previous two posts, we have deployed Django with Postgres, Nginx, now its time to do some async stuff using Celery. In this post, I will do the magic tricks first, explain them later. Table of contents ︎ Add ‘Celery’ to django Make a …

Serve Static Files by Nginx from Django using Docker

This is more of a follow up post of my previous blog. Before I start, I am assuming you have successfully deployed django using docker and nginx, but having some problems serving static files. Table of contents ︎ Steps Update Steps No worries, it is …

Deploy Django, Gunicorn, NGINX, Postgresql using Docker

This post mainly based on this blog: https://docs.docker.com/compose/django/. I will be extending this post by serving django+gunicorn using Nginx, also I will using Postgresql docker container to use it as database. Table of contents ︎ Steps Create …

Make MacOS Notifications From RSS Feed Using Python

Today we are going to see how make OSX notifications from RSS Feed of any website using Python. So first of all, let us see how to make a simple notification. We are going to use AppleScript for this. Table of contents ︎ Command for notification in …

Make .CSV file using MySQL and Python

In this blog, I am going to show how to develop an application by which we can make .csv files from MySQL database using Python. Table of contents ︎ Steps SQL command Run SQL command in python To csv In conclusion Steps SQL command Now, let us start …

Django 1.7 and Scrapy

This post is deprecated. Use it at your own risk. Today I am going to share how to use Scrapy and Django together to crawl to a website and store scraped data to Database using Django. Table of contents ︎ Project setup Django Scrapy Screenshots

Make a Blog using Django Part 2

This post is now deprecated. Please follow the official tutorial for creating your first django application. From previous post, you have configured and ran django, also added admin site to the django. To view the working source of this tutorial, check …

Make a Blog using Django Part 1

This post is now deprecated. Please follow the official tutorial for creating your first django application. “Making a blog using django” - is probably the most made tutorial of Django. This post is no different. But I made this in my own way …

Change Column Headers in Django Tables 2

Django Tables2 is a package which displays table directly from queryset. It shows column header based on object’s attribute name. But if someone wants to override it, how can he/she do that? Here is a easy solution. Table of contents ︎ Model class …

Dynamically constructing filters based on string input using SQLAlchemy

Here I am going to write a dynamic filter. This filter is made for python 3. It will take query or model class and filter condition as input, It will return filtered query based on those filter condition. This is constructed using this SO answer. Table of …

How to configure Django and Tornado in PyCharm Community Edition

I think, Pycharm is THE best IDE for developing python. But unfortunately, the professional edition is not free. But community edition is good enough for doing debugging, integrating GIT etc. Normally its easy to use the community edition for django and …

Some Useful Tools/Function for Django

This post is deprecated as its based on Django 1.6 mostly. I am going to share some useful Django tools/functions which are very useful(were for me atleast) to get things done. Table of contents ︎ Return any model class and its properties Distance …

Working with Formsets

This post is deprecated and may not be useful. As documentation says: A formset is a layer of abstraction to work with multiple forms on the same page. It can be best compared to a data grid. So here I am going to show a very simple django formset …

Sample Ajax GET/POST Request in Django

Let us make a test scenario here: A dropdown field which on change we are going to send a Get/Post request to Django and return response. Let us start coding…. Table of contents ︎ HTML code Create an Ajax request Handle AJAX request in django view …

Using IntellijIdea/Pycharm Within An Exisiting Virtualenv

To add a virtual environment to Intellij Idea, You have added Python from virtualenv folder to project SDK. Which means that virtualenv directory’s python( for example venv/bin/python2.7) needs to be added to Intellij Idea project path. Table of …

Implementation of Forgot/Reset Password Feature in Django

This post is deprecated in favour of django authentication views Django has its own implementation for reset/forgot password for its admin site. We are going to use that piece of code as reference to implement similar feature for a non admin-site …

Perodic Tasks By Celery 3.1 Example

This post is deprecated. It is no longer compatible with latest Celery versions. I am assuming you have read celery docs from Celery Documentation. As we know, celery can be used as a scheduler for executing asynchronous tasks in periodic cycles. Here I …

Syncdb vs Migration

While surfing through Stackoverflow, I find a common question among Django users that, database not working properly; fields attribute changed, yet not working etc. Clearly because most of them used syncdb after altering fields. Well, lets make some things …

RichText Editor in Django Admin Site

I wanted to add a rich text editor within django administrator. It is not that hard to add a rich text editor, as there are editors like CKeditor, Tinymce. Table of contents ︎ Download ckeditor file Writing forms.py Generated text Download ckeditor …

Django Translation Using .PO File

This post is deprecated. Please follow the official documentation. When comes to using multiple languages in one single site, Django is very handy. You can use .po file to do your translation for you. Table of contents ︎ How to do that How to do that …