Published inPython in Plain English·Jan 18Python Adventures — LoggingThis article assumes that you are familiar with the following: coding in Python 3 Python classes Python logging library The purpose of this article is to document how we can use the Python logging library to record/capture/log whatever information we want in more than one destinations in the local filesystem. …Python7 min readPython7 min read
Published inPython in Plain English·Nov 7, 2021Adventures in Django: Django Unit TestingThis article assumes that you are familiar with the following: designing Django models performing CRUD operations on a Django model running a Django migration with makemigrations and migrate creating unit tests with Python’s unittest framework The purpose of this article is to encourage automated unit testing on Django models before…Django7 min readDjango7 min read
Published inPython in Plain English·Apr 26, 2021Integrating OAuth2 in Django with GitHub and OAuthlibIntroduction If you have several social media accounts, such as Google, Twitter, Facebook, and GitHub, and would prefer to use one of these accounts to log into websites that support third-party logins, you should read this article. …Django9 min readDjango9 min read
Published inPython in Plain English·Mar 22, 2021Deploying Django on AWS and BitnamiI recently attempted to deploy my Django projects on Amazon Lightsail and took notes for myself on the issues that came up for me. For starters, the AWS documentation for deploying a plain Django app without any database can be found here. On the AWS console, we will find many…Django5 min readDjango5 min read
Published inPython in Plain English·Mar 10, 2021Adventures in Django: Django Mail with FormView and Simple CaptchaIt’s common in most websites to allow visitors to interact with them through an HTML Form. To distinguish a human visitor from a machine or bot, a captcha challenge is typically included in the form as well. Some of these forms facilitate communication between a visitor and the website. Submitting…Django9 min readDjango9 min read
Published inPython in Plain English·Feb 28, 2021How to implement multiple ModelForms in a View in DjangoDjango provides a simple-to-code solution to edit your model in an HTML form if you use its class-based generic editing view such as UpdateView. You can see a sample implementation of this in my article, Editing A Single Model Instance with UpdateView. However, in the real world, a complex application…Django7 min readDjango7 min read
Published inPython in Plain English·Feb 28, 2021Editing A Single Model Instance with UpdateView in DjangoIn my last article, Leveraging OO in Models and Views, I described how we can maximize object-oriented programming techniques in implementing custom behavior in our Django models to hide model-specific QuerySet API and to take advantage of Django’s class-based generic views, such as DetailView to reuse code and minimize development…Python6 min readPython6 min read
Published inPython in Plain English·Feb 23, 2021Adventures in Django: Custom 404 TemplatesThere are many HTTP status codes that can be returned from a web server; one of them is the infamous 404 Not found error code. This error is raised when a particular page cannot be located on the website. …Django3 min readDjango3 min read
Published inPython in Plain English·Feb 18, 2021Adventures in Django: Leveraging OO in Models and ViewsIn my previous article on Model Relationships, I described how Django implements one-to-one, one-to-many and many-to-many model relationships using the OneToOneField, ForeignKey and ManyToManyField. Today I'm going to document how to leverage the power of object-oriented programming when writing Django models and views. In a Django app that plans an…Django6 min readDjango6 min read
Published inPython in Plain English·Feb 14, 2021Adventures in Django: Model RelationshipsThis article assumes a readership who is familiar with Python, Django and database schema design. Django explains its architecture as following an MTV (Model-Template-View) paradigm where model is the central component that encapsulates data and behavior for a web application, view is the mechanism that defines what data is to…Django6 min readDjango6 min read