Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
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
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 … -
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. -
How I Tested ReactJS-based Webapp with Selenium
For quite some time, I have been building a SaaS product - strategic prioritizer 1st things 1st. It's using Django in the backend and ReactJS in the frontend and communicating between those ends by REST API. Every week I try to make progress with this project, be it a more prominent feature, some content changes, or small styling tweaks. In the past week, I implemented frontend testing with Selenium, and I want to share my journey with you. What can you do with 1st things 1st 1st things 1st allows you to evaluate a list of items by multiple criteria and calculates priorities for you to follow and take action. The service has 4 main steps: Defining criteria.Listing out things.Evaluating things by each criterion.Exploring the priorities. Selenium is a testing tool that mimics user interaction in the browser: you can fill in fields, trigger events, or read out information from the HTML tags. To test the frontend of 1st things 1st with Selenium, I had to enter the user credentials and login,create a project from a blank project template,add some criteria,add some things to do,evaluate each thing by each criterion, andsee if the generated list of priorities was correct. Let's … -
How to handle multiple sites (virtual hosts) in Django
How to handle multiple sites in Django: the problem Consider a set up where the same Django project has a bunch of apps that could be reached from multiple domains: With a default set up every request to www.example-a.dev, www.example-b.dev, or www.example-c.dev is free to reach the URL configuration of any installed app. This could harm SEO, especially for content-heavy Django applications. What I mean is that if you have a blog app with any number of pages, the same pages will be served on www.example-a.dev, www.example-b.dev, and www.example-c.dev. It's not unusual to have a single Django project serving requests for multiple domain names, and it's important to isolate the requests so the right domain is paired with the corresponding Django app. In this tutorial you'll learn how to handle multiple sites in Django. Dear Host header, we need to talk Before getting into details we need to remember that an HTTP header named "Host" is sent any time a browser makes a request to a website. You can check the header by opening a browser's console. In the Network tab (Firefox in this example) look for the Host request header (open up the console and visit any website): If … -
Django News - Django Peeps in the PSF - Apr 10th 2020
News Announcing a new Sponsorship Program for Python Packaging The Python Package Index (PyPI) responds to 800 million requests and delivers 200 million packages totalling 400 terabytes during the typical day. Our users include hobbyists, scientists, companies, students, governments, nonprofits, and more. blogspot.com PSF Fellow Members for Q1 2020 Congratulations to Django Individual members Tom Christie and Kenneth Love being named PSF Fellow Members for Q1 2020! The above members have contributed to the Python ecosystem by teaching Python, creating education material, contributing to circuitpython, contributing to and maintaining packaging, organizing Python events and conferences, starting Python communities in their home countries, and overall being great mentors in our community. Each of them continues to help make Python more accessible around the world. To learn more about the new Fellow members, check out their links above. blogspot.com Articles psycopg3: a first report — Daniele Varrazzo psycopg is the most popular PostgreSQL driver for Python. In this article, Daniele talks about the development of version 3 which would add async support. varrazzo.com Hyphens vs Underscores in Django To underscore or not to underscore that is the question that Tim Allen explores along with dashes. pyphilly.org How Django Uses Metaclasses For Data … -
Building User Interfaces
Full show notes are available at https://www.mattlayman.com/django-riffs/4. -
Onboarding Forms - Building SaaS #51
In this episode, we added the first form to collect data in the onboarding flow. We used a CreateView and defined all the fields that are needed in the HTML form. I started by filling in the HTML form structure of the page. Once the dummy version was in place, we changed from a TemplateView to a CreateView and began fixing each configuration error that the new view type reported as missing like missing a model field declaration. -
Translations - Andrew Knight
Weekly Django Chat NewsletterAutomationPanda.com@automationpandaEast Meets West When Translating Django Apps article and video (21:20 - 45:40)PyCarolinasdjango-news.comDjango i18N Google Group -
Speeding up a Django web site without touching the code
I’ve recently been tweaking my server setup for a Django 1.3 web site with the goal of making it a bit faster. Of course, there is a lot of speed to gain by improving e.g. the number of database queries needed to render a web page, but the server setup also has an effect on the web site performance. This is a log of my findings. All measurements have been done using the ab tool from Apache using the arguments -n 200 -c 20, which means that each case have been tested with 20 concurrent requests up to 200 requests in total. The tests was run from another machine than the web server, with around 45ms RTT to the server. This is not a scientific measurement, but good enough to let me quickly test my assumptions on what increases or decreases performance. The Django app isn’t particularly optimized in itself, so I don’t care much about the low number of requests per second (req/s) that it manages to process. The main point here is the relative improvement with each change to the server setup. The baseline setup is a Linode 1024 VPS (Referral link: I get USD 20 off my … -
Comics v2.2.0 released with Django 1.5 support
Version 2.2.0 of my comics aggregator is now released. It features a general upgrade of dependencies, including the move from Django 1.4 to Django 1.5, and a lot of updates to comic crawlers. The Django upgrade was completed months ago and it’s been running my Comics instance since, so it’s about time to get it released before Django 1.6 arrives in a month or two. Regarding the crawler updates, it’s a bit sad to see that many of the crawlers have been broken for months without me or anybody else noticing, but it’s hard to catch some content lacking in the middle of a firehose of similar content. I guess I’ll have to make it a monthly task to look through the crawler status page of my Comics instance and do patch releases with updated crawlers. Check out the project docs for more information about Comics and this release in particular. -
Comics v2.3.0 released with better mobile support
Version 2.3.0 of my comics aggregator is now released. As always, dependencies have been updated, including the routine Django upgrade from Django 1.5 to 1.6, just in time for the upcoming 1.7 release. The largest change this time around is the move from Bootstrap 2 to 3, which includes a refreshed, flatter design and lots of tweaking to make Comics both look good and work nicely on mobile devices, something it didn’t use to do. The dependency overview at requires.io has been a great motivation for doing some maintenance work on Comics. The only dependency left outdated is django-registration, as 1.0 moves to class-based views, which requires some larger changes to my customizations. Thus, the upgrade of django-registration has been deferred together with the related upgrade of my vendorized copy of django-invitation. Most, if not all, of the other dependencies seems to support Python 3 now, though some lack the right Trove classifiers in their PyPI registration, so they are not correctly labeled by requires.io. I found an open pull request for cssmin and a recent commit for django-compressor adding the missing Trove classifiers. I’ve also done my part to improve the Python 3 metadata by sending a pull request … -
Episode 4 - Building User Interfaces
On this episode, we look at templates, the primary tool that Django provides to build user interfaces in your Django app. Listen at djangoriffs.com. Last Episode On the previous episode, we talked about views and how views handle requests to create HTTP responses for users. Set Up Templates are static files that Django will fill in with data. In order to use those files, we must instruct Django on where to find them. -
Django Security Headers Hall of Fame
It’s been a year since I published How to Score A+ for Security Headers on Your Django Website, the blog post for my DjangoCon Europe 2019 talk. It’s seen some updates as both Django and web security have evolved, for example Feature-Policy is now required for an A+, and Django 3.0 includes built-in support for Referrer-Policy. I’ve received a lot of nice feedback for the post and the talk. Here are some of the people who’ve used it to increase their sites’ security: Kristian Glass took app.emporium.cloud to an “A” score (tweet). This site is useful for exploring the dependency graph of all package on PyPI. Çağıl Uluşahin and Ahter Somnez took their site LindyPlus to a “B” (tweet). Aidas Bendoraitis took his site 1st things 1st to an “A”, including adding a strong CSP (tweet). Tobias Kunze took Pretalx to an “A” (tweet). Thanks to all for letting me know. If you have used the guide to improve your site’s security, please email or tweet me, and I’ll add a link here! As you can see, you don’t need to get to A+, which is a lot of work. Any improvement is good for your site and users :) … -
How to Provide Test Fixtures for Django Models in Pytest
One of the most challenging aspects of writing good tests is maintaining test fixtures. Good test fixtures motivate developers to write better tests, and bad fixtures can cripple a system to a point where developers fear and avoid them all together. The key to maintaining good fixtures is to find a good balance between flexibility and usability. Good fixtures are ones that are easy to use and easy to modify. In my latest article for RealPython I share some insights on how to maintain good test fixtures for Django models using Pytest. The article covers everything from setting up Pytest for a Django project, creating test fixtures and how to create dependency between fixtures. The article focuses on a pattern called "factory as a service". Using this pattern, you can create fixture for Django models that depend on other fixtures. This makes it easier to set up data for tests and focus on the the scenario at hand rather than setting up the data. Read "How to Provide Test Fixtures for Django Models in Pytest" on RealPython ≫ How to Provide Test Fixtures for Django Models in Pytest -
How to create a Django project and a Django application
How to create a Django project To start off create a new folder for the Django project and move into it: mkdir django-quick-start && cd $_ Here I called django-quick-start the main folder that will hold the project. Pay attention, this is not the actual Django project, but just its "home". Once inside the new folder create a Python virtual environment and activate it (note, these are two distinct commands): python3 -m venv venv source venv/bin/activate Next up install Django with: pip install django When the installer is done you can create a new Django project: django-admin startproject django_quick_start . Pay attention again: django_quick_start now is the actual Django project created inside the django-quick-start folder. The name of this home folder doesn't matter, but Django projects cannot have dashes in the name. That's the reason for these underscores in django_quick_start. Pay also attention to the dot in django-admin startproject django_quick_start .. With the dot we can avoid additional folder nesting. How to create a Django application Every Django project is made of stand alone applications. Each application may have models, views, and custom logic. There is also a great choice of community applications ready to be installed in your project. … -
Django News - Bye Bye Python 2 - Apr 3rd 2020
News Django bugfix releases issued: 3.0.5 and 2.2.12 With this release, Django 1.11 has reached the end of extended support. All Django 1.11 users are encouraged to upgrade to Django 2.2 or later to continue receiving fixes for security issues. djangoproject.com Django Release Cycle A graphical guide to Django’s release cycle. jefftriplett.com New pip resolver to roll out this year The developers of pip are in the process of developing a new resolver for pip which is slated to release the second half of this year. They are asking for your help. blogspot.com Articles What the heck is pyproject.toml? Brett Cannon explains why pyproject.toml exists and why it's the future of packaging in the Python ecosystem. snarky.ca Postgres 11 and Docker Docker's Postgres image recently introduced a breaking change. This is a short tip on how to handle it. conorcunningham.net Build secrets in Docker Compose, the secure way How to build Docker images securely using "build secrets" for when you need a password to install from a private package repository yet you don't want the secret embedded in the finished image. pythonspeed.com Automating the Boring Stuff in Django Using the Check Framework How we use inspect, ast and the Django … -
Onboarding Continuity - Building SaaS #50
In this episode, we stepped from the welcome onboarding page to the first interactive page in the flow. I extracted the common banner for each of the templates and customized it for each of the steps in the process. The first thing we did was create a button on the starting page. The button connects the welcome page to the second step in the flow where the app will ask for information about the user’s school year. -
Templates For User Interfaces
In the previous Understand Django article, we looked at the fundamentals of using views in Django. This article will focus on templates. Templates are your primary tool in a Django project for generating a user interface. Let’s see how templates hook into views and what features Django provides with its template system. Set Up Templates We need a place for templates to live. Templates are static files that Django will fill in with data. -
LearnDjango.com
Weekly Django Chat NewsletterLearnDjango.comwsvincent.comDjango Slug TutorialDjango for Professionals bookDjango Caching for BeginnersDjango Markdown Tutorial