Django – NGINX is a popular and well tested combination used to deploy web applications in production. In this post I will explain the steps needed to have your Django project deployed on a production server using Ubuntu 18.04.
Since Wordpress version 5.2 - in the case of fatal errors in your code - the scary WSOD (white screen of death) was substituted with a more elegant page with an error message "The site is experiencing technical difficulties". This…
Docker is a popular container management platform that can dramatically speed up your development workflow. It is available as a package on major Linux distributions, including Ubuntu.
The standard data directory used for docker is /var/lib/docker, and since this directory will store all your images, volumes, etc. it can become quite large in a relative small amount of time.
If you want to move the docker data directory on another location you can follow the following simple steps.
Suppose you want to install all the apt packages already installed on one server to another one. On the source machine execute the following commands to make a list of installed packages and their "states" (installed manually or automatically): sudo…
Suppose you need to write down your model fields on an Excel file, for example to complement the documentation of your code.
Django has built in functions to introspect models and fields of an app, and you can leverage this API to have the information you need.
Say you have a Django web application that you want to integrate with emails to make it possibile to send data and files to your web application over SMTP.
The good news is that Python has a simple SMTP daemon in the standard library, together with modules to parse emails. Let’s see how to create a simple email gateway on top of these tools.
In this tutorial I will explain how to deploy a Django project in 15 minutes with Ansible. I will assume that you are a Django developer and you have built and tested a project locally. It’s time to deploy the project on a public server to let users access your awesome application.
If you are new in deploying Django on a production server you can read my post Django – NGINX: deploy your Django project on a production server to have a basic introduction on the steps needed.
So you need a VPS with an SSH access, then you will access the server, install and configure all necessary software (web server, application server, database server), create a database user, configure Django to use it, copy your Django project on the server, migrate the database, collect static files, trial and error, fix, trial and error, …
All this boring stuff will take some good hours that you should definitely spend in a more profitable way, don’t you think? The good news is that you can automate almost all the work needed to go from a vanilla VPS to a fully deployed server hosting your Django project.
Follow this tutorial and I’ll show you how to leverage the power of Ansible to automate all the needed steps in 15 minutes. Are you ready? Check the time on your clock and follow me!
Sometimes it can be useful to completely drop all tables in a database, for example to reset a DB to a previous version from a backup. After checking that you are doing this on the right database and that you know…
Just discovered a quick and dirty way to resize a bunch of jpeg files to a maximum resolution and size: mogrify -resize 1024x1024 -strip -define jpeg:extent=200kb *.jpg This command will resize all jpg images in the current directory with a…