Author: Rahul

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Docker offers a way to run applications in a consistent environment, which simplifies deployment and scaling. FastAPI is a modern, fast web framework for building APIs with Python based on standard Python type hints. In this article, we’ll guide you through the process of dockerizing a FastAPI application. Prerequisites Basic understanding of Python and FastAPI. Docker installed on your machine. Steps to Dockerize a FastAPI Application 1. Create a FastAPI application Before we start with the Dockerization process, let’s create a basic FastAPI application. If you have an existing application skip this step. Here’s a simple `main.py`: from fastapi import…

Read More

Today, Docker is a popular tool for running and managing apps. A common task is to send network traffic from a port on your computer to a port in a Docker container. This is useful if you want to share a service in the container with the outside world or set up a reverse proxy for load balancing. In this article, we will show you how to forward a port to a Docker container using iptables, a firewall tool in most Linux systems. Step 1: Identify the IP address of the Docker container Run the following command to find the…

Read More

Python modules are a convenient way to encapsulate and organize reusable code. If you find yourself copying and pasting the same code across multiple scripts or projects, it’s a good indication that you should consider creating a custom module. In this article, we’ll guide you through the process of creating and using your custom Python module. 1. Understand the Basics A module in Python is simply a file containing Python definitions and statements. The file name is the module name followed by the .py extension. For instance, a module named mymodule would be saved as mymodule.py. 2. Create the Module…

Read More

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python. It’s built on standard Python type hints, making it easy to use, while providing a lot of advanced features for developers. When building a FastAPI application, it’s crucial to separate configuration from the code, especially database connection details, for security and modularity. Using .env files and structured code can make this process more secure and maintainable. In this article, we will look at integrating FastAPI with MySQL to handle database operations. Setting up FastAPI with MySQL 1. Setting up the environment: Create a new virtual environment: python3…

Read More

GitHub is an essential tool for developers, providing a platform to store, share, and collaborate on code. One common question among users is how to create an empty directory or folder in a GitHub repository. GitHub does not support creating empty directories directly. However, there’s a workaround to this using a dummy file, usually a .gitkeep file. In this article, we’ll explore the steps and reasoning behind this method. Why Doesn’t GitHub Support Empty Directories? Git, the underlying version control system upon which GitHub is based, tracks file changes. Empty directories don’t contain any files, so Git doesn’t track them.…

Read More

Virtualization has become a crucial technology in modern IT landscapes. It allows multiple operating systems to run concurrently on a single physical machine, optimizing resource usage and flexibility. Broadly speaking, there are two main types of virtualization: Type 1 (Bare Metal) and Type 2 (Hosted). In this article, we’ll dive deep into understanding the differences between these two types, their advantages, disadvantages, and best-use scenarios. 1. What is Virtualization? Virtualization refers to the creation of virtual versions of something, such as hardware platforms, storage devices, or network resources. In the context of servers and desktops, it usually means running multiple…

Read More

Podman is a container management tool that provides similar functionality to Docker but is designed to be daemonless and rootless. This means you don’t need a long-running background service (daemon) to manage your containers, and you don’t need root privileges for most operations. In this article, we will cover how to install and use Podman on Ubuntu 22.04 & 20.04 LTS systems. Installing Podman on Ubuntu 1. Update the System: Before you begin, ensure that your system package database is up-to-date: sudo apt update && sudo apt upgrade -y 2. Install Podman: Podman is available in the default Ubuntu repositories,…

Read More

Django, the powerhouse web framework built on Python, offers robust functionalities out-of-the-box. One of its most crucial yet sometimes overlooked features is its capability to handle configuration using environment variables. Environment variables provide a way to set up configurations outside of the codebase, thereby allowing better security and flexibility. This article aims to simplify the concept of custom environment variables in Django and provide a hands-on approach to set them up like a pro. Why Use Environment Variables in Django? Before we delve deep into the configurations, let’s first understand why we even need environment variables: Security: Hardcoding sensitive data…

Read More

Django, a popular web framework in the Python ecosystem, is built to be flexible and secure. One way to enhance security is to avoid hardcoding sensitive information (like secret keys or database passwords) directly in the source code. Instead, such information should be stored in environment variables, which can be read into the Django application at runtime. Environment variables offer a level of abstraction and separation between configuration and code, which is beneficial in terms of security and portability. This article provides a comprehensive guide on how to read system environment variables in a Django project. 1. Setting Up Environment…

Read More

Setting up Laravel with Docker and Docker Compose is an excellent way to create a consistent development environment. Docker simplifies app deployment by packaging everything needed, from code to libraries, in isolated containers, so your Laravel app can run smoothly on any system. With Docker, developers can avoid the common “it works on my machine” problem by ensuring that everyone’s development setup is the same. Laravel, one of the most popular PHP frameworks, is great for building robust web applications, and pairing it with Docker makes it even easier to manage and deploy. In this guide, we’ll walk you through…

Read More