Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
A Story Worth Telling: 10 Design Trends to Watch in 2019
Did you know that stock photos are passé, asymmetry is in, and accessibility is an increasing focus for designers? Find out which design trends we expect to see more of in 2019. The post A Story Worth Telling: 10 Design Trends to Watch in 2019 appeared first on Distillery. -
Quiet down 'faker' in pytests
Faker is a nice library for creating sample data for tests. No more company called "example company" and no more email address "something@example.org". No, you get readable random proper email addresses and company names and so. Handy in combination with factory_boy, which provides integration. Here's an example: from myproject import models import factory class PersonF(factory.DjangoModelFactory): class Meta: model = models.Person email = factory.Faker("email") name = factory.Faker("name") password = factory.Faker("password") class TeamF(factory.DjangoModelFactory): class Meta: model = models.Team name = factory.Faker("company") Problem I'm having is that, when running the tests with pytest, pytest helpfully reports all the logging when something goes wrong. Only, tests related to factory_boy/faker fill the log with locale-related messages: factory.py 97 DEBUG Looking for locale `en_US` in provider `faker.providers.address`. factory.py 111 DEBUG Provider `faker.providers.address` has been localized to `en_US`. factory.py 97 DEBUG Looking for locale `en_US` in provider `faker.providers.automotive`. factory.py 111 DEBUG Provider `faker.providers.automotive` has been localized to `en_US`. factory.py 97 DEBUG Looking for locale `en_US` in provider `faker.providers.bank`. Which makes it harder to spot the actual error. There's been a recent helpful change to faker, reducing those log messages from INFO to DEBUG. So fixing these extraneous messages was as simple as including these lines at the … -
De-Google my life - Part 2 of ¯ (ツ)_/¯: Servers and Emails
Hello everyone! Welcome to the second post of this blog series that aims to de-google my life as much as possible. If you haven’t read the first one, you should definitely check it out. On this delivery we’ll focus more on code and configurations so I promise you it won’t be as boring :) Servers configuration As I mentioned on the previous post, I’ll be using two servers that are going to be configured almost the same, so I’m going to explain it only one time. In order to host my servers I’m using DigitalOcean because I’m very used to their UI, their prices are excelent and they accept Paypal. If you haven’t yet, you should check them out. To start, I’m using their $5 server which at the time of this writing includes: Ubuntu 18.04 64 bits 1GB RAM 1 CPU 1000 GB of monthly transfers Installation On my first SSH to the server I perform basic tasks such as updating and upgrading the server: sudo apt update && sudo apt ugrade - y Then I install some essentials like Ubuntu Common Properties (used to add new repositories using add-apt-repository) NGINX, HTOP, GIT and Emacs, the best text editor … -
De-Google my life - Part 2 of ¯ (ツ)_/¯: Servers and Emails
Hello everyone! Welcome to the second post of this blog series that aims to de-google my life as much as possible. If you haven’t read the first one, you should definitely check it out. On this delivery we’ll focus more on code and configurations so I promise you it won’t be as boring :) Servers configuration As I mentioned on the previous post, I’ll be using two servers that are going to be configured almost the same, so I’m going to explain it only one time. In order to host my servers I’m using DigitalOcean because I’m very used to their UI, their prices are excelent and they accept Paypal. If you haven’t yet, you should check them out. To start, I’m using their $5 server which at the time of this writing includes: Ubuntu 18.04 64 bits 1GB RAM 1 CPU 1000 GB of monthly transfers Installation On my first SSH to the server I perform basic tasks such as updating and upgrading the server: sudo apt update && sudo apt ugrade - y Then I install some essentials like Ubuntu Common Properties (used to add new repositories using add-apt-repository) NGINX, HTOP, GIT and Emacs, the best text editor … -
Best way to count distinct indexed things in PostgreSQL
`SELECT COUNT(*) FROM (SELECT DISTINCT my_not_unique_indexed_column FROM my_table) t` -
Best way to count distinct indexed things in PostgreSQL
`SELECT COUNT(*) FROM (SELECT DISTINCT my_not_unique_indexed_column FROM my_table) t` -
Coding for Time Zones & Daylight Saving Time — Oh, the Horror
In this post, I review some reasons why it's really difficult to program correctly when using times, dates, time zones, and daylight saving time, and then I'll give some advice for working with them in Python and Django. Also, I'll go over why I hate daylight saving time (DST). TIME ZONES Let's start with some problems with time zones, because they're bad enough even before we consider DST, but they'll help us ease into it. Time Zones Shuffle Time zones are a human invention, and humans tend to change their minds, so time zones also change over time. Many parts of the world struggle with time changes. For example, let's look at the Pacific/Apia time zone, which is the time zone of the independent country of Samoa. Through December 29, 2011, it was -11 hours from Coordinated Universal Time (UTC). From December 31, 2011, Pacific/Apia became +13 hours from UTC. What happened on December 30, 2011? Well, it never happened in Samoa, because December 29, 23:59:59-11:00 is followed immediately by December 31, 0:00:00+13:00. Date Time Zone Date Time Zone 2011-12-29 23:59:59 UTC-11 2011-12-30 10:59:59 UTC 2018-12-31 00:00:00 UTC+13 2011-12-30 11:00:00 UTC That's an extreme example, but time zones change more … -
Coding for Time Zones & Daylight Saving Time — Oh, the Horror
In this post, I review some reasons why it's really difficult to program correctly when using times, dates, time zones, and daylight saving time, and then I'll give some advice for working with them in Python and Django. Also, I'll go over why I hate daylight saving time (DST). -
Backup & Load Live Heroku PostgreSQL Database to Local Django Project
I've used [Django fixtures](ht... -
Where to Learn Django in 2019
I quite often get asked for resources on where to learn Django. Here’s a list of the places I know! The Deep End First, a warning: there’s a lot of stuff to know. Learning Django with zero web or programming knowledge is diving in at the deep end. If you’ve never done anything like it, you’ll be learning about Python, databases, HTML, CSS, browsers, Git, Django, and more, all at the same time. I’d recommend knowing how to build a static website before attempting to learn Django. There are many ways to do this, for free tutorials check out W3Schools or Learn Web Development from Mozilla. But if you think you’re ready to begin, let’s continue. Written Tutorials First and foremost is the official “Start” page which links to several things, including the official tutorial. A warning: the tutorial is quite comprehensive, and is not really designed for zero-experience beginners. It also has some blind spots, for example it does not feature any advice on installing Python, or deploying your website to the actual internet. The Django Girls tutorial is a full guide to creating and deploying a blog for free. This organization uses it to teach weekend workshops to … -
Convert SVG Icons To CSS Webfonts and Deploy to CDN
If you're like me, you've undo... -
Create a Standalone React App
This post will answer the foll... -
10 Common Design Mistakes… and How to Avoid Them
Design work is complex business. It’s far too easy to mess up. To create high-quality products, all of the small details are crucially important. Each detail must be taken into account. It can be easy to get lost in the details and lose sight of the big picture. That’s why there are several incredibly common user interface (UI) design mistakes and weaknesses. The post 10 Common Design Mistakes… and How to Avoid Them appeared first on Distillery. -
Hello Linux: Celery & Supervisor
<div class='alert alert-succes... -
Hello Linux: Install Redis
<div class='alert alert-succes... -
Tips for Testing Django Views
Views are probably the most essential part of a Django application. They provide an interface to your application for users or other external applications. It only makes sense that these need to be well-tested. At first, it can seem difficult and/or tedious to write unit tests for them. However, by decoupling your business logic from … Continue reading Tips for Testing Django Views The post Tips for Testing Django Views appeared first on concise coder. -
Tips for Testing Django Views
Views are probably the most essential part of a Django application. They provide an interface to your application for users or other external applications. It only makes sense that these need to be well-tested. At first, it can seem difficult and/or tedious to write unit tests for them. However, by decoupling your business logic from … Continue reading Tips for Testing Django Views The post Tips for Testing Django Views appeared first on concise coder. -
De-Google my life - Part 1 of ¯ (ツ)_/¯: Why? How?
Hi everyone! I’m here with my first project of the year. It is almost done, but I think it is time to start documenting everything. One day I was hanging out with my girlfriend looking for trips to japan online and found myself bombarded by ads that were disturbingly specific. We realized at the moment that Google knows A LOT of us, and we were not happy about that. With my tech knowledge, I knew that there were a lot of alternatives to Google, but first I needed to answer a bigger question: Why? I told my techie friends about the craziness I was trying to accomplish and they all answered in unison: Why? So I came up with the following list: Privacy. The internet is a scary place if you don’t know what you are doing. I don’t like big corporations knowing everything about me just to sell ads or use my data for whatever they want. I have learned that if something is free it’s because you are the product EXCEPT in opensource (thanks to /u/SnowKissedBerries for that clarification. Security. I live in a very controlled country (Venezuela). Over here, almost every government agency is looking at you, … -
De-Google my life - Part 1 of ¯ (ツ)_/¯: Why? How?
Hi everyone! I’m here with my first project of the year. It is almost done, but I think it is time to start documenting everything. One day I was hanging out with my girlfriend looking for trips to japan online and found myself bombarded by ads that were disturbingly specific. We realized at the moment that Google knows A LOT of us, and we were not happy about that. With my tech knowledge, I knew that there were a lot of alternatives to Google, but first I needed to answer a bigger question: Why? I told my techie friends about the craziness I was trying to accomplish and they all answered in unison: Why? So I came up with the following list: Privacy. The internet is a scary place if you don’t know what you are doing. I don’t like big corporations knowing everything about me just to sell ads or use my data for whatever they want. I have learned that if something is free it’s because you are the product EXCEPT in opensource (thanks to /u/SnowKissedBerries for that clarification. Security. I live in a very controlled country (Venezuela). Over here, almost every government agency is looking at you, … -
Using Multiple SSH Keys
Every time you use a new host,... -
Using SSH & Creating SSH Keys
Using a Secure Shell (`ssh`) w... -
Hello Linux: Custom Domain & Https with Let's Encrypt
<div class='alert alert-succes... -
Hello Linux: Nginx & UFW Firewall
<div class='alert alert-succes... -
Hello Linux: Gunicorn & Supervisor
<div class='alert alert-succes... -
Hello Linux: PostgreSQL on Live Linux Server
<div class='alert alert-succes...