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.
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.
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.
In a previous article, I showed how to easily deploy django on a shared server. Shared servers also provide a options of database servers that you can use for your project.
IMPORTANT UPDATE. This article is still relevent if you want to host Django 1.11 and 2.x projects. But Django 3 requires a higher version of Python. You can read my new article on how to set up Django 3 with A2 hosting here. Moving you django project from a local development environment to the open internet can be a daunting task, especially when you have a tight budget. There are free options with pythonanywhere and Heroku and probably others. For my first 'live' project, I used pythonanywhere for a while, but found it limiting. I wanted the freedom and the budget prices that shared servers offer, that I had gotten used to developing wordpress and other php based websites.