how-to πŸ“™

How To Add New line to String Using Python new line Character.

The Python Newline character is a special Python character that produces line breaks. It is made up of a backslash and the letter n (\n). All characters in a string that appear after the newline character will be printed on a new line Because of those special characteristics, it can also be called a line-break […]

Python Trim Whitespace: How To Trim String Whitespace In Python Using strip(), lstrip(), and rstrip()

In Python and other programming languages, to trim whitespace is to remove any extra blank or empty space around a word or character in a string. In Python, we use the function strip() and its younger siblings lstrip() and rstrip() to trim whitespace in a String. We usually work with strip(), lstrip(), rstrip() when dealing […]

Python Comment Block: How to Block Comment In Python.

In JavaScript, we use the forward slash and the asterisk (/*, */) to comment out a block of code. In C#, Java, Golang, Rust, etc., commenting out a block of code can be done using the same combination of symbols as in JS. In other programming languages, a block of code can be commented out […]

How to fix typeerror: __init__() missing 1 required positional argument: β€˜on_delete’ in Django

I mentioned an error called: typeerror: __init__() missing 1 required positional argument: β€˜on_delete’ in my post about the significance of the Django on_delete argument and its 7 options. But that was just mentioned, I did not really explain why the on_delete error happened, when does it happen, and most importantly, how to fix it when […]

Django MySQL: How to Connect to MySQL Database from Django (Best Methods) πŸ”—.

Django, the Python web development framework that we all love, comes with many built-in features that are beneficial to the developer. At some point during the development of a Django project, you create a superuser whose signup details (username, email, and password) you can use to login into a beautiful, feature-rich admin panel where your […]

How to Install and Set up FastAPI Project on Your Computer: pip install fastapi.

This step-by-step guide will show you how to install FastAPI and set up a FastAPI project on your computer. We will start with a few requirements needed before one can install FastAPI and create a web project with it, then we will go step by step into installing FastAPI along with other dependencies. Last but […]

How To Create app Inside Django Project ~ Django startapp.

The command django-admin startproject project_name creates a Django project called project_name in the folder you ran the command in. The project folder structure looks like the below: Django uses the name of your project (the one you entered in the command) as the name of your project configuration folder as well. A much more recommended […]

How to Upload Django Project to Github.

Git is a version control system that lets you go back to any version of your code, even if you delete something important by accident. It also lets you keep track of all your work through commits and work with other developers. In this post, I’ll show you how to upload a Django project to […]

How To Show Image In Django Admin.

ImageField is the default image uploading field in Django. By default, when you upload an image from Django’s admin panel, it will display the name/URL of the image rather than the picture itself, this post will show you how to show an Image in Django admin after uploading it. In this post, I use an […]

Scroll to top