Below you will find pages that utilize the taxonomy term “Django”
Django and NGINX in Docker
In this post we will run Django application behind a NGINX webserver, which is a very common practice in production.
Django CRUD (Create, Retrieve, Update, Delete)
One of the most common task when developing web application is to write create, read, update and delete functionality (CRUD) for each table you have.
In this post I briefly cover the step needed to create a CRUD app in Django, the steps we will need are:
Django with Docker: Add Postgres
In the last post I covered starting a new Django project with Docker, and how to build a custom container image for my project, but what I haven’t covered is how to use a Database and how persist your data since all data stored in the container ephemeral and would only exist during the life span of the container.
Django with Docker: Build an Image
Docker is an interesting technology, although still young it gained a lot of buzz and momentum.
The last couple of weeks I started playing with Docker to see how can I use it for Django project development and deployment.
Django: How to pass an url as parameter of include
Django CRUD Parent/Child Edition
Django Image and File Field Caveats
Django memory leak with gunicorn
If you have a long running job that leaks few bytes of memory it will eventually will consume all of your memory with time.
Django Themes (or where to put base.html?)
The Wrong Way
I used to create a new directory to hold common templates like “base.html”, and add it TEMPLATES_DIR in the settings.py file:
Translation in Django
Preparing Django project to support multiple langauges is easier than you think!
Django returning JSON for AJAX requests
In your views.py
you can have a page that return JSON data for AJAX request like this:
Setting Up Python and Supervisor on CentOS
CentOS default repository is very limited, and even if you install EPEL you will get old packages, in my case I needed to install Supervisor to manage my Django application, after trying to do it manually and through EPEL I ended up with the following setup.
Django Multiple Settings with Single File
Instead of having multiple settings files one for production and one for development and so on, I prefer to use an “if” statement with environment variable:
Django “render” vs “render_to_response”
Summary: Always use render
and not render_to_response
In Django you have more than one way to return a response, but many times I get confused between render
and render_to_response
, render_to_response seems shorter, so why not use it!
Implementing Login/Logout in Django
Update: add names and namespace to URLs
Implementing user authentication is fairly easy job in Django, many functionalities are already included in the standard Django installation, you can manage users using the default “admin” app the comes with Django.
Here I will show how implement Login/Logout feature by relying on Django built-in views.
Django Serving Static Files without a Web Server
Minimal Django Project: Part 2 … Flat Pages
Minimal Django Project: Part 1 … First Run
My Python and Django bookmarks
Django backend benchmark
Deploying Django
Django is a web framework written in Python language, my favourite computer programming language.
Python a language is really great language, easy to read and understand, and very easy to learn, but for me I always found setting up Python for web development as a challenge, socially if compare it to PHP, which almost works out of the box, actually most people think PHP works only in the web server and can’t work as stand alone application, search for PHP CLI if you are interested.
I will try here to document an easy Django deployment for my future reference and hopefully it will help others: