Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Deep dive: Django Q and SQS
Deep dive: Django Q and SQS When working on a Django application the de facto recommendation for a task queue is Celery. I believe this is a good recommendation. It is kind of like buying IBM - “no one was ever fired for buying IBM”. I started using Django Q more recently and it is doing a great job. One system I built using it processes roughly 400k tasks per day. Surely not the largest system and surely not the most impressive number, but decent enough to say that Django Q is a solid choice. But as with many smaller projects there are sometimes a few gotchas you are running into. This becomes painfully obvious when setting up an app using SQS. Let me walk you through the steps I took to make Django Q play nicely with our AWS setup at Grove Collaborative. Redis is great, but… First of all you have to configure Django Q to use SQS. You do this by adding the Q_CLUSTER dictionary to your settings.py with the sqs key. If you are familiar with AWS and boto3 you might know that you can either provide the AWS region when initialising a new connection or … -
Django Best Practices: Security
Django is a mature, battle-tested web framework with a well deserved reputation for security over the past 15+ years.However the internet remains a dangerous place and web security is an … -
Embedding videos in feincms3
Embedding videos in feincms3 I have been using oEmbed services for about 10 years now to embed content from YouTube and Vimeo on other sites, first using feincms-oembed and later using feincms3.plugins.external. This worked well enough despite some problems such as Embed.ly introducing API keys and Noembed being more or less unmaintained since 2017. However, the requirement to fetch data from a different service always bothered me, especially since all I wanted (most of the time) was to generate a bare <iframe> containing the embed, nothing more. django-embed-video was almost what I needed but it had some worrysome thumbnail fetching code in there; also I didn’t understand the reason for defining backends, dynamically importing them etc. when all I wanted was a function where I would get back some HTML when passing a supported URL, or nothing if the URL wasn’t supported. Since I really like writing code1 here’s my solution to embedding YouTube and Vimeo videos as a part of feincms3, feincms3.embedding. Since it doesn’t depend on an external service (except the obvious ones) it is never gonna give you up if you just call: from feincms3.embedding import embed html = embed("https://www.youtube.com/watch?v=dQw4w9WgXcQ") Maybe it’s just a really strong NIH … -
Django Search Tutorial
__Note__: I gave a version of this tutorial at DjangoCon US 2019. You can see the video here: -
From PHP and SWISDK2 to Python and Django – 12 years later
From PHP and SWISDK2 to Python and Django – 12 years later Once at a time1 there was an agency founded by a few friends and myself. We were using PHP at the time and had our own framework, the SWISDK – Simple Web Infrastructure SDK; quite a mouthful. It supported many features which are now commonplace in web frameworks such as an ORM, a mostly autogenerated admin interface, forms which could be used together with models, some sort of routing, generic views2, XSS and CSRF protection, support for translations in the code and the database, images, galleries, comments etc. I think I had Django on my radar for quite a while already. I liked the template language and especially the template inheritance feature so much that I reimplemented it as an extension to the Smarty template engine. Smarty has built-in support for template inheritance since 2009 but I didn’t profit from this anymore, because we migrated to Python and Django in 2008 and have never looked back. This was after manipulators had been replaced by the newforms library (the current django.forms) but before the newforms admin and before Django 1.0. I also took a long and hard look at … -
Tweet from Django application using Tweepy
In this tutorial, we will learn how to post a tweet from Django application using Tweepy. -
<p>django-debug-toolbar 3.0 is now <a target="_blank" rel="nofollow" href="https://pypi.org/project/django-debug-toolbar/3.0/">available on PyPI</a>. Please help with testing or with success stories o
django-debug-toolbar 3.0 is now available on PyPI. Please help with testing or with success stories or with bug reporting & squashing. -
Django Authentication With GitHub
In this tutorial, we will build a Django application that allows users to sign in via their GitHub account. -
Django News - DjangoCon Europe starts soon. PyCon Africa talks now live. - Sep 17th 2020
News Python Software Foundation News: Noah Alorwu Awarded the PSF Community Service Award for Q2 2020 Noah Alorwu, software developer and co-founder of DjangoCon Africa has been awarded the Python Software Foundation 2020 Q2 Community Service Award. blogspot.com Pip: Buy a feature The Pip team wants your input on a survey to figure out what is most important to you. google.com Events DjangoCon Europe 2020 DjangoCon Europe kicks off September 18th. Tickets are still available for €29.00 and €79.00 for anyone who wants to support DjangoCon Europe and attend virtually! pretix.eu Articles r2c blog — Not all attacks are equal: understanding and preventing DoS in web applications From Django co-creator Jacob Kaplan-Moss, a guide to understanding and preventing Denial of Service (DoS) attacks. r2c.dev How to Unit Test a Django Management Command - Adam Johnson Management commands are an extremely useful feature in Django, but can be difficult to test. Adam Johnson demonstrates how to do so. adamj.eu Is Django a Full Stack Framework? An overview of back-end vs front-end frameworks and where Django sits in the mix. learndjango.com Sponsored Link Mystery Science Theatre 3000 with Your Friends Privately stream movies and chat with your friends on WeeVee. Read about … -
Running Django as a hidden service
Tor has many uses, especially for oppressed and persecuted people, people who have to fear for their safety when accessing information on the internet. The more people use Tor, the safer it gets. -
Administering Your App
Full show notes are available at https://www.mattlayman.com/django-riffs/8. -
feincms may still be relevant
feincms may still be relevant About 10 years ago there existed a few Django-based CMS. If someone didn’t already know which to choose, the following three systems were seen as reasonable choices3: Mezzanine. There were some doubts about Mezzanine’s maintenance status, see this Jazzband issue but they were unfounded. django CMS. Perhaps the best known Django-based CMS back then and maybe now too. feincms1 The landscape has changed. Wagtail hasn’t been the new kid on the block anymore for a long time. I have been following the development of those CMS more or less closely over the years and am convinced that all of them are good choices for starting new projects. We’re still using feincms at Feinheit; or more often django-content-editor and feincms3, especially for new projects. Since the development of the feincms 1.x line has slowed down to maintenance mode and the community of feincms3 is really small you might ask why we’re still sticking with those tools – we’re certainly asking it ourselves from time to time. Here’s a list of reasons why feincms is still relevant: There’s only one autogenerated administration interface to maintain and explain to users – the stock Django administration interface. It works … -
Regular Expressions in Python
Regular expressions, aka `rege... -
Angular 10 and Django 3 Image Files Upload with FormData
Throughout this tutorial, we'll see how we can implement file and image upload in Django 3, Django REST Framework and Angular 10 with a step by step example. Our application will expose an /upload REST API endpoint that accepts POST requests which contain the image file posted with a multipart/form-data content type via FormData. For the frontend, we'll be using Angular 10 to create a simple interface that allows the user to select a file or image and upload it to the server via a POST request using HttpClient and FormData. In the first section, we'll create the Django 3 REST API application and use a REST API client to test the upload endpoint. Next, in the second part, we'll proceed to create a frontend application with Angular 10 for uploading the image to the REST API server using HttpClient and FormData. Let's get started! Prerequisites For this tutorial, you will need to have a few prerequisites such as: Python and pip installed on your system. We'll be using Python 3.7, Familiarity with Python and Django. Node.js and NPM installed on your system. These are required by Angular CLI. Familiarity with TypeScript. Creating a Virtual Environment & Installing Django 3 … -
Django Community Survey
Django Community SurveyDjango PeoplePyCon AU 2020 playlistPyCon Africa 2020 playlistDjangoCon Europe 2020Django News newsletterWorking in Public by Nadia EghbalSupport the ShowOur podcast does not have a sponsor and is a labor of love. To support the show, please consider purchasing one of the books on LearnDjango.com or suggest one to a friend. -
Integrate Summernote Editor in Django application
In this tutorial, we will learn how to integrate Summernote WYSIWYG Editor in Django. -
Django x MongoDB
Here's a simple guide to using... -
Redis on Mac & Linux
Redis is a very popular data s... -
Django properties from expressions, or ComputedField part 2
I've discussed the concept of a [ComputedField](https://schinckel.net/2018/11/12/django-computedfield(\)) in the past. On the weekend, a friend pointed me towards SQL Alchemy's [Hybrid Attributes](https://docs.sqlalchemy.org/en/13/orm/extensions/hybrid.html). The main difference here is that in a ComputedField, the calculation is always done in the database. Thus, if a change is made to the model instance (and it is not yet saved), then the ComputedField will not change it's value. Let's look at an example from that original post: {% highlight python %} class Person(models.Model): first_name = models.TextField() last_name = models.TextField() display_name = ComputedField( Concat(F('first_name'), Value(' '), F('last_name')), output_field=models.TextField() ) {% endhighlight %} We can use this to query, or as an attribute: {% highlight python %} Person.objects.filter(display_name__startswith='foo') Person.objects.first().display_name {% endhighlight %} But, if we make changes, we don't see them until we re-query: {% highlight python %} person = Person(first_name='Fred', last_name='Jones') person.display_name # This is not set {% endhighlight %} So, it got me thinking. Is it possible to turn a django ORM expression into python code that can execute and have the same output? And, perhaps the syntax SQL Alchemy uses is nicer? {% highlight python %} class Person(models.Model): first_name = models.TextField() last_name = models.TextField() @shared_property def display_name(self): return Concat( F('first_name'), Value(' '), F('last_name'), output_field=models.TextField(), … -
Redis on Windows
Redis is a very popular data s... -
django-tree-queries
django-tree-queries The reason for this blog post is the recent release of django-tree-queries 0.4. django-tree-queries allows using an SQL database to retrieve tree nodes in depth-first search (DFS) order. Other libraries Many Django libraries exist already for managing and retrieving tree-shaped data. A list of them follows along with reasons why none of them are being used in feincms3. django-mptt I still am a heavy user of django-mptt. FeinCMS 1.x uses it and we therefore use django-mptt as well for many sites which are actively maintained. I also am a co-maintainer of django-mptt so the following critique should be understood with this fact in mind. django-mptt uses the nested set model with an additional level and tree_id field; the latter partitions nodes into individual, unconnected trees. This is a useful performance optimization. In principle, the nested set model doesn’t even require a parent foreign key for nodes; however, django-mptt always adds this field as well. django-mptt is very dependent on having up-to-date values of the left, right and parent_id values. Fetching ancestors or descendants does not work when those values are outdated. Calling .save() with outdated values absolutely will cause corrupted trees – that is, the MPTT attributes get out … -
From Concept To Live In Two Weeks With Django
My team had two weeks to make a viable product. We were a random group of people pulled together with a desire to help our local community in Frederick, Maryland. We were a student, a web designer, a former realtor turned IT support person, and a software developer. Our mission, which was put forth by the virtual hackathon that brought us together, was to try to make a tool to help the local homeless. -
Understanding the Application and Request Contexts in Flask
This post provides clarity on how the Application and Request contexts work in Flask. -
Slugify Urls in Django
In this tutorial, we will learn how to slugify urls in Django. -
Measuring Hiring Manager Effectiveness
Hiring is one of the most important parts of a manager’s job. Make good hires and your team (and thus the whole company) will have better results. Make poor hires, and those people will drag the team down. In the worst cases, a toxic hire can drive other staff to quit, totally destroying the team. Strangely, for such an important part of the job, hiring performance seems to be very poorly measured.