Posts for: #Python

Django + HTMX CRUD application

Introduction

Gone are the days of writing Ajax requests with javascript, just add a few parameters to the HTML content tags and you will be ready for sending requests to your backend. So, we are going back in time and correcting the way we think of APIs and client/server-side rendering. We are referring to the Hypermedia model for levering the server-side processing of data. Let’s get our feets wet with this ancient but revolutionary methodology of development with HTMX.

[]

Deploying Django Project with Railway Nixpacks

Introduction

We have seen how to deploy a Django application on railway app in the previous article of the series. We deployed the django project using the Heroku Buildpacks under the hood. The railway app provides a couple of options on how to build your web application. Currently, there are three options, one of which is the heroku buildpacks which is the default one, second, we have the nixpacks which we will see today, and the third is the Paketo buildpack.

[]

APTUI

A terminal interface for testing and working with APIs and web requests.

[]

Django Project with PostgreSQL Deployment on Railway App

Introduction

We have already seen the process of deployment of a Django app on Heroku, now we can move to another platform which is Railway App. This allows a faster and more intuitive way to deploy a Django app(or any sort of web app). This platform has several Starter Apps for shipping your app in several clicks, definitely, it would require some configuration and tweaking a bit.

We will be following similar steps from the Django-Heroku Deployment Guide for configuring and setting up our Django project for the deployment on the Railway app. We explore a few different ways to create and deploy a Django project on Railway.

[]

Django + PostgreSQL Deployment on Heroku

Introduction

Django projects are quite easy to build and simple to understand, you might have created a Django application and wanted to show it to the world? You can deploy a basic Django application with a database(PostgreSQL) with Heroku. It provides a decent free tier with some great features and add-ons. A free tier Heroku account has a limitation of 5 apps, limited data in the database, limited connections to the server per month, and so on.

[]

Python: Search and Replace in File

Searching and Replacing the text in a File

Using simple python semantics, we can perform search and replace in a file. Firstly, we will define the file name, along with the words to search and replace. After defining the sets of variables, we will open the file in r+ mode i.e. we can perform read as well as write operations in the file.

We will store the entire file contents using the read function, the contents of file are now stored in the form of a string. We further can set the position of the cursor or the current position in the file using the seek function. The seek function takes in a optional parameter as the position to set for reading/writing of file. Using the truncate function, we can clear all the contents of the file.

[]

Feedparser: Python package for reading RSS feeds

Introduction

Feedparser is a simple but powerful python package that can be used to extract information about a specific webpage or a publication with its RSS feed(not only RSS). By providing the RSS feed link, we can get structured information in the form of python lists and dictionaries. It can be basically used in a pythonic way to read RSS feeds, it is really simple to use and it even normalizes different types of feeds.

[]

Pipx: A python package consumption tool for CLI packages

Introduction

Previously, I explored the pipenv as a python package management tool and this week it is time for exploring a python CLI package isolation tool called pipx. It is a really simple and powerful tool for running commands as an executable from an isolated environment. Those commands should be associated with a python package that has CLI. In pipx, we install the package once and we can use the package anywhere on our system isolated from other virtual environments.

[]

Pipenv: Python’s Official Package Management tool

Introduction

Pipenv is Python’s officially recommended Package management tool, as the name suggests it combines the power of pip and virtualenv. It is really powerful and gives control of package management for a python project. It also has support for adding dev packages, python versions, smartly recognizing main and derived package installation/uninstallation, and so on. It is the official package management tool for Python.

It is quite similar to npm for Nodejs in Javascript, or bundle for Ruby, cargo for Rust, and so on. It really simple and easy to use as it manages the overhead for package management for us and hence it is also a high-level package management tool as opposed to pip, which is not as powerful as Pipenv. So, in this article, we’ll explore Pipenv package manager for Python and how you can use it in your next python project. Let’s get started.

[]