Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
My mom was always right | Rant on social media
My mom always hated social media. My bother and I always made fun of her because she was always late to all the news. Her main reason against social media was “why would I want everyone to know what I’m doing? And why should I care what they are doing?”. I didn’t understand at the time, but now I do. I remember when I was 13 years old social media started ramping up. I created a MySpace account to go with the flow. I won’t lie, I liked MySpace a lot: creating a website that “defined me”, sharing my music, posting funny pictures and checking my friends' profiles. It all seemed pretty cool and innovative. Then it came to Facebook, where you couldn’t create your own site or share music players like in MySpace, but you had a wall and your friends could leave messages on your wall! How cool was that? You could share pictures, thoughts, opinions, and your friends didn’t have to go to your profile to check it out: Facebook had a feed with all your friends' posts, so there was no need to visit their profile just to see what they were doing. It sounded very … -
My mom was always right | Rant on social media
My mom always hated social media. My bother and I always made fun of her because she was always late to all the news. Her main reason against social media was “why would I want everyone to know what I’m doing? And why should I care what they are doing?”. I didn’t understand at the time, but now I do. I remember when I was 13 years old social media started ramping up. I created a MySpace account to go with the flow. I won’t lie, I liked MySpace a lot: creating a website that “defined me”, sharing my music, posting funny pictures and checking my friends' profiles. It all seemed pretty cool and innovative. Then it came to Facebook, where you couldn’t create your own site or share music players like in MySpace, but you had a wall and your friends could leave messages on your wall! How cool was that? You could share pictures, thoughts, opinions, and your friends didn’t have to go to your profile to check it out: Facebook had a feed with all your friends' posts, so there was no need to visit their profile just to see what they were doing. It sounded very … -
Managing Secrets with Vault and Consul
This post looks at how to set up and use Hashicorp's Vault and Consul to securely store and manage secrets. -
Django News - Issue 20 - Apr 24th 2020
Articles Beginner Sourdough: Does anything really matter? urllib3 creator and maintainer Andrey Petrov deep dives and shares his thoughts on a subject that's been on everyone's mind lately, a guide on how to read sourdough recipes. 🍞 medium.com Oops! Removing Secrets from Django Project in Docker Have you ever accidentally committed a SECRET_KEY or another sensitive setting to a git repository and wondered how to remove it? startcodingnow.com Sync Data to and From Google Sheets with django-gsheets The django-gsheets Django app makes two-way data sync from models to Google Sheets simple. meanpug.com Podcasts Django Chat #60 - Advanced Deployment with Katie McLaughlin Katie is a Developer Advocate for Google and regular conference speaker. Discussion covers advanced deployment techniques and tools such as Google Cloud Run, relational vs non-relational databases, Terraform, and more. djangochat.com Tutorials Effective Python Testing With Pytest A wonderful tutorial on pytest benefits, approach, and how to apply to any Python project. realpython.com Handling Periodic Tasks in Django with Celery and Docker A detailed tutorial on using Django, Celery, and Redis together. testdriven.io How To Create a URL Shortener with Django and GraphQL Create a non-relational GraphQL backend for a URL shortener: a service that takes any URL … -
Introducing django-gsheets, an easy way to sync to and from Google Sheets
Django ships with a great admin interface, it's one of the top reasons the framework is chosen. Often though, the need (or "need") arises to view and manipulate model data in a spreadsheet instead of the web admin. Rather than go through the traditional ETL process of exporting this data to a CSV to be loaded into a Google Sheet (or visa versa), django-gsheets makes syncing data between Google Sheets and your Django app as simple as executing python manage.py syncgsheets.Two-way data sync from Django to Google SheetsHere are some common reasons you might want two-way sync in your app.performing running audits of data quality in a table or set of tablesproviding an interface for external users to upload structured data (e.g. think mechanical turk)giving non-technical users an efficient way to scrub data in bulkUsing django-gsheets in your projectGetting started with django-gsheets should be a familiar task for the Django developer. We start by installing the necessary dependencies then add some configuration to our settings.py to integrate the app in our project. Note: this guide is basically a long form version of the repo README, so if you're just itching to get started you should probably stop reading and start … -
More Onboarding Goodness - Building SaaS #53
In this episode, we continued with onboarding. I added unit tests for the new form and explained how foreign keys are wired through in CreateView. Then we marched on to the next template in the flow. In the last stream, we set all the context data for the view that shows the form to create a grade level for the school. With the context in place, and the form structure set, I added the form class that will create the GradeLevel record. -
Oops! Removing Secrets from Django Project in Docker
So you’ve been frantic as you try to fix a bug. You get lost in the work and totally forget where you are. All of a sudden… SUCCESS!… -
Advanced Deployment - Katie McLaughlin
Weekly Django Chat NewsletterTwitter @glasntKatie's talksPyCon 2020 - What is deployment, anyway? (video)PyCon 2020 - Tutorial: Deploying Django on Serverless Infrastructureih-aas repo Google Cloud SQLGoogle Cloud RunCloud Run buttondjango-demo-app-unicodexAja Hammerly thread on Developer Advocates being busy without conferencesDjangoCon Europe 2016 - Building a Non-Relational Backend for the ORM - Adam Alton (video) (djangae)"Every production setup will be a little bit different" - djangoproject.com -
Google Cloud CLI & SDK Setup
Google Cloud has a number of a... -
Oops! Removing Secrets from Django Project in Docker
So you’ve been frantic as you try to fix a bug. You get lost in the work and totally forget where you are. All of a sudden… SUCCESS! It works! Amazing. But oh no, you just put your secrets into a tracked file. What to do, what to do… Project Overview So I’ve been saying “you”, but I really mean “me”. Here’s a short summary of my project, then we’ll get into how I fixed it. Web app coded in Python Using the Django web framework Using Docker with a Dockerfile and docker-compose.yml for containerization Deployed to Heroku Had a problem serving static files on Heroku and not locally, so I implemented an Amazon S3 bucket for remote file storage, which requires secrets! Up until this point, I’ve tracked my docker-compose.yml file so that if I want to work on this project on another computer, it will be easy to clone and get going. But I’m hosting this code on GitHub and may share it some day, so I don’t want secrets available. Fixing Django’s SECRET_KEY My docker-compose.yml file has my Django SECRET_KEY inside it. When prepping to deploy to Heroku, all I did was generate a new key and … -
Handling Periodic Tasks in Django with Celery and Docker
This post looks at how to manage periodic tasks with Django, Celery, and Docker. -
Remote debugging a Django project with VS Code
In this tutorial you will learn how to use VS Code for remote debugging. I’ll show you how to debug a Django application running on a remote server over SSH or in a Docker container. Imagine the following scenario: You developed a Django application on your laptop. You did your tests and made some debug. The application worked fine. Finally you deploy the application on a production server. Something goes wrong. There is a bug to hunt down and you cannot reproduce it locally. You could connect to the remote server using SSH, then use a remote editor like vim on nano to tweak the code. You could put some print("I'm here!") here and there, trying to find the bug. But wait, aren’t you a VS Code user? Why you have to debug in an editor you don’t know? Wouldn’t be great if you could connect to the remote environment from VS Code and debug your application inside the IDE you love? It turns out that VS Code has some extensions made exactly for that purpose, and you’ll learn how to use them. At the end of this tutorial you will be able to: Connect with VS Code to a … -
Remote debugging a Django project in VS Code
In this tutorial you will learn how to use VS Code for remote debugging. I’ll show you how to debug a Django application running on a remote server over SSH or in a Docker container. Imagine the following scenario: You developed a Django application on your laptop. You did your tests and made some debug. The application worked fine. Finally you deploy the application on a production server. Something goes wrong. There is a bug to hunt down and you cannot reproduce it locally. You could connect to the remote server using SSH, then use a remote editor like vim on nano to tweak the code. You could put some print("I'm here!") here and there, trying to find the bug. But wait, aren’t you a VS Code user? Why you have to debug in an editor you don’t know? Wouldn’t be great if you could connect to the remote environment from VS Code and debug your application inside the IDE you love? It turns out that VS Code has some extensions made exactly for that purpose, and you’ll learn how to use them. At the end of this tutorial you will be able to: Connect with VS Code to a … -
Setup AWS CLI for Local Development
This post is related to an upc... -
AWS S3, IAM Group & Policy Setup
In this one, we'll be setting ... -
Django, Axios and CSRF token
Django, Axios and CSRF token I am building a "hybrid web app" (I'll post on it in the near future) using Vue to the front and Django to the back. A "hybrid web app" is something between a SPA and a classic website. The server sends the HTML template, the HTML template has a Vue component and then Vue takes place, mounts on it and do its things. The app consists of some forms. When the user presses the submit button, the Vue component will make a POST XMLHttpRequest (aka AJAX request) using the axios library and the server will respond with some JSON data. The reason I want to make an AJAX call and not a usual form submit is that I do not want the page to refresh and the state of my Vue app re-initialize. So far so good. Since, my Django view is CSRF protected, I want axios to properly handle the CSRF token for me and everything work transparent. Fortunately, axios has two config settings (xsrfHeaderName and xsrfCookieName) which set the proper header of the request in order to pass the csrf token to the server. However, axios gives you the possibility to add (extra) … -
Django, Axios and CSRF token
Introduction I am building a "hybrid web app" (I'll post on it in the near future) using Vue to the front and Django to the back. A "hybrid web app" is something between a SPA and a classic website. The server sends the HTML template, the HTML template has a Vue component and then Vue takes place, mounts on it and do its things. The app consists of some forms. When the user presses the submit button, the Vue component will make a POST XMLHttpRequest (aka AJAX request) using the axios library and the server will respond with some JSON data. The reason I want to make an AJAX call and not a usual form submit is that I do not want the page to refresh and the state of my Vue app re-initialize. So far so good. Since, my Django view is CSRF protected, I want axios to properly handle the CSRF token for me and everything work transparent. Fortunately, axios has two config settings (xsrfHeaderName and xsrfCookieName) which set the proper header of the request in order to pass the csrf token to the server. However, axios gives you the possibility to add (extra) headers using the headers … -
Django News - Virtual PyCon! - Apr 17th 2020
News Wagtail 2.7.2 and 2.8.1 security release Fixes a cross-site scripting (XSS) vulnerability. github.com PyCon US Online PyCon US went virtual this year and has started releasing videos. Check it out. pycon.org Articles A Quick and Dirty Guide on How to Install Packages for Python Python core developer, Brett Cannon, walks us through the various ways to install something with Python. snarky.ca Using VueJS alongside Django Learn how to integrate Django templates with VueJS. tkainrad.dev A Month in the Life of a DSF Board Member A look at the work of Board Members on the Django Software Foundation, the non-profit that runs Django. wsvincent.com Using Markdown in Django Describes the development of a Markdown extension to address challenges in managing content using Markdown in Django sites. hakibenita.com Sponsored Link Django for Beginners A step-by-step guide to building web applications with Python and Django 3.0. djangoforbeginners.com Podcasts Django Chat #59 - JustDjango with Matthew Freire JustDjango is a popular YouTube channel and website dedicated to Django learning resources. Discussion covers how Matthew learned Django, building the website itself, payments, mentors, and more. djangochat.com Tutorials Django on Azure - beyond "hello world" A comprehensive guide to running Django on Microsoft Azure. github.io … -
Consistent Onboarding - Building SaaS #52
In this episode, we glued together some of the onboarding steps. I added data validation so that future steps depend on data existing from previous steps. Then we added page messaging to direct users to a proper page. We reviewed the way that the form validates certain data from the form submission so that data is kept safe between users. I showed how I switched from the model and fields attributes of CreateView to a form_class containing the form that does the necessary validation. -
JustDjango - Matthew Freire
Weekly Django Chat NewsletterJustDjango.comJustDjango on YouTubeCapRoverplyr.io -
A Quick Guide to Generating Fake Data with Pandas
Photo by Chris Curry. Last August, our CTO Colin Copeland wrote about how to import multiple Excel files in your Django project using Pandas. We have used Pandas on multiple Python-based projects at Caktus and are adopting it more widely. Since Colin’s post, Pandas released version 1.0 in January of this year and is currently up to version 1.0.3. Pandas is fairly popular in the data analysis community. It was showcased at PyData NYC 2019, and was planned to be highlighted during multiple sessions at Pycon 2020 (before the event was canceled). A Pandas core developer will give a keynote at the postponed PyData Miami 2020 event (date to be determined). In this article, I’m going to take you through the steps to create some sample fake data in a CSV file. Large fake datasets can be useful when load testing your code. Pandas makes writing and reading either CSV or Excel files straight-forward and elegant. Using NumPy and Faker to Generate our Data When we’re all done, we’re going to have a sample CSV file that contains data for four columns: We’re going to generate numPy ndarrays of first names, last names, genders, and birthdates. Once we have our … -
A Quick Guide to Generating Fake Data with Pandas
Last August, our CTO Colin Copeland wrote about how to import multiple Excel files in your Django project using pandas. We have used pandas on multiple Python-based projects at Caktus and are adopting it more widely. -
Continuously Deploying Django to DigitalOcean with Docker and GitHub Actions
In this tutorial, we'll look at how to configure GitHub Actions to continuously deploy a Django and Docker application to DigitalOcean. -
Spring updates while trying to stay healthy
So, spring grows nearer for those of us on the Northern hemisphere. With everyone hopefully hunkered down and safe from the Covid-19 pandemic, I thought it overdue to make another dev blog for the progress of Evennia, the Python MU*-creation system. The last few months have seen primarily bug fixing on the Evennia front, but it also has seen an uptick of PRs from the community and the re-opening of the develop branch in earnest. There is still quite a lot of work to do before we can add that extra 0.1 and go from version 0.9 to 1.0.What's in a version?For me personally, I never put much stock in the notion of versions. Evennia didn't even have versions until a few years back: We used to just have a rolling git release. But eventually it became clear that our user base was big enough that we needed to more clearly separate major (and possibly breaking) updates from what came before. So I started versioning at Evennia 0.5 and have had roughly a new release every year since (not a plan or a promise, it just happened to turn out that way).Evennia has been useful (and been used) for game … -
A Month in the Life of a DSF Board Member
A look at what Board Member duties on the Django Software Foundation.