Hosting your Django 3 Project with A2 Hosting

June 5, 2020 Chris Shaw Tutorials 377 views

It has been over a year since my inital post regarding hosting your Django Project with A2 Hosting and a few things have changed in that time, so it is time for an update. My earlier post is still relevent for Django versions 1.x and 2.x, but Django 2.2 was the last to support Python 3.5. Django 3.0 supports Python 3.6, 3.7, and 3.8. You can read the release notes here. The other major change is that Python App in your A2 cPanel has been updated and improved. BUT there is a kicker. Unfortunatly the Python 3.7.3 that is on the A2 server has been compiled with SQLite 3.6.20 where Django 3.0 requires SQLite 3.8.3 or later. This means we cannot use SQLite and will use the MySQL database instead. In any case, you should not be using SQLite in a production enviroment.

READ ON


Django Forms, Overriding the queryset on a select field to exclude options already used.

May 6, 2019 Chris Shaw Tutorials 4553 views

In a Django form, It is posibble to override the queryset that produces the results displayed in a 'select field' from a foregin key. In this tutorial, we will pass valuse from the view to the form to build the queryset.

READ ON


Setting django's static and media URLS

March 4, 2019 Chris Shaw Tutorials 6178 views

Setting your static and media urls for your django project on a shared server is simple. Make it habit to be one of the first things you do as you start a new project. All the examples in this project are for django version 2.x.

READ ON


Django 2.1 and Sentry integration with Custom Error Pages.

Feb. 28, 2019 Chris Shaw Tutorials 1691 views

So you have built a Django site, the client is happy and you put it in production mode in the wild. But what if there are errors in cases that you could not even have imagined? How do you make sure you know what errors that users are experiencing? At the very least you should enable logging, with email alerts being sent for any ERROR or CRITICAL level errors. This is probably acceptable for a low traffic site. I would however reccomend using Sentry with thier powerful Djando intergration. In this tutorial, we will look at how easy it is to intergrate a free Sentry account with our project, and as a bonus, set up some custom error pages that also send logs to Sentry and even have an optional feedback form.

READ ON


Managing static files with django on a shared server

Feb. 14, 2019 Chris Shaw Tutorials 551 views

Getting the static files to display correctly when hosting your django site on a shared server is quick and easy in a few steps.

READ ON