How To Use a Python Variable in an External Javascript (Django)

One way to use a Python variable in an external Javascript is to declare the JS variable in the HTML template through the context object, then pass this variable to the external script code :

HTML
 
<script type="text/javascript"> 
  js_var_from_dj = "{{ django_var }}";
</script>
<script src="https://dzone.com{% static "js/js_file.js" %}" type="text/javascript"></script>

js_file.js :

Performance Evaluation of Python

In a class, some students are multi-talented and score well in all the spheres — sports, academics, and debates. There are some students, who are only good in sports and not in academics. And we have a lot of students who are good at none. So where does this smart, handsome boy named Python belong to?

We need to evaluate the performance while looking at the different capabilities and accomplishments before making a performance card. So let's check the calculations.

CockroachDB With Django and MIT Kerberos

Today, I'm going to talk about the means of using Django with a kerberized CockroachDB and what that entails. This is not uncommon in a production use case and expecting enterprise-grade access to development frameworks is table stakes for some of our customers.

Articles Covering CockroachDB and Kerberos

I find the topic of Kerberos very interesting and my colleagues commonly refer to me for help with this complex topic. I am by no means an expert at Kerberos, I am however familiar enough with it to be dangerous. That said, I've written multiple articles on the topic which you may find below:

Top 5 Python Frameworks, Libraries, and Packages for Web Development

Hello folks, if you want to become a Python web developer and wondering which Python frameworks, libraries, and packages you can learn then you have come to the right place.

Earlier, I have shared the best Python courses, Python interview questions, and python libraries to become a better and competent python developer, and today, I am going to share the best Python framework you can learn to become a full-stack Python developer.

Django: Context Processors for Custom Environments

Django's context processors enable you to set global variables that are easily accessible in templates. In a few lines of code, you can customize your app's environment for a variety of user groups. For instance, we use context processors to segment user access and toggle features based on a user group.

For the example below, let's assume that users are grouped into three categories:

How To Use CockroachDB With Your Django Application

This tutorial is intended to be a quick ramp-up on CockroachDB with Django.  In case you're searching for a proper Django tutorial, this is not it. At the time of writing, django-cockroachdb library is available in two versions, (2 and 3). This tutorial will cover version 3, and is inspired by the Digital Ocean tutorial using Django with PostgreSQL. I am going to highlight the steps where this tutorial differs from the original. For everything else, we will assume the tutorial is followed as is.

I originally wrote this post two years ago and had since updated it as CockroachDB RBAC is no longer an enterprise-only feature so we can skip that step. I'm also including steps to launch a Docker instance to make this more portable and comprehensive.

Async Support in Django

Hello, my dear readers! Yes, this article is about the web framework for perfectionists with deadlines, as well as Django’s lack of async support. It’s more like an Enhancement Proposal (less formal than it could be) or RFC. So, if you like that sort of thing, you might be interested. 

Django Foundation has also considered the issue of adding async support. Their discussions have resulted in DEP-09, which describes the current approximate roadmap. I have even discovered that my post doesn’t contradict it. It’s just that it has very little information about async-native support. It is considered the last stage that still needs to be reached. This reminds me of a meme about how to draw an owl: first, we draw two circles, and then we finish the rest.

Build an Analytics Dashboard With Django and Arctype

Introduction

As Python's premier web framework, Django provides the foundation upon which many web applications have been built, facilitating rapid development without sacrificing stability.  Amongst other versatile functionalities, Django integrates seamlessly with SQL databases, so today, we'll be using the framework to implement basic site analytics data recording.  Then, we'll use this data to create gorgeous visualizations in an Arctype dashboard, which will keep track of the following:

  • Registrations, logins, and logouts.
  • User activity by day.
  • Breakdown of user activity on a selected day.

To achieve this, we will be utilizing Django's ORM and Arctype (of course!)

Comparison of 11 New Python Web Frameworks

Python has been the go to language for building web services, right from quick-and-dirty RESTful APIs to full-fledged web applications that serve millions of users. If you have been dabbling in this area, you'd have probably used some of the most popular web frameworks already — Django, Flask, Falcon, Tornado, CherryPy, among others.

In the last few years, though, there have been many new kids on the block. These new frameworks have taken a fresh approach with a focus on the performance and expressiveness of the API. Here’s a comparison of new web frameworks in Python that you should consider for your next side project.

Django Async: What’s New and What’s Next?

Starting with Django 3.1, the latest version that dropped a couple of weeks ago, Django now supports fully asynchronous request path. This is exciting for everyone who’s been waiting on the edge of their seats ever since Andrew Godwin’s DEP 0009 was approved by Django Technical Board in July 2019. Read on to know all about what this release means if you have a Django application in production and looking to add async support. At DeepSource, we’re working on adding more Django issues in our Python analyzer, which will also include async-specific bug risks and anti-patterns.

Support for Asynchronous Views and Middleware

In Django 3.1, async features are now supported across the request-response cycle. This means you can define fully asynchronous views using the async keyword:

Deploying a Django Application to AWS EC2 Instance With Docker

In AWS, we have several ways to deploy Django (and not Django applications) with Docker. We can use ECS or EKS clusters. If we don't have one ECS or Kubernetes cluster up and running, maybe it can be complex. Today, I want to show how deploy a Django application in production mode within a EC2 host. Let's start.

The idea is create one EC2 instance (one simple Amazon Linux AMI AWS-supported image). This host doesn't initially have Docker installed. We need to install it. When we launch one instance, when we're configuring the instance, we can specify user data to configure an instance or run a configuration script during launch.

How to Build a CRUD Application Using React and Django

In this tutorial, we are going to build a CRUD application for storing books with React and Django. CRUD stands for Create, Read, Update and Delete, so basically this app would work like a library shelf where we can take a look at each book data being able to modify as we want or need.

Technologies Used

For this application, we will be using two very popular solutions for building user interfaces and APIs. The user interface of the application will be built using React – prior knowledge of React is not required for this tutorial.

7 Vue.js Backends Compared

Which backend are you planning to use for your next Vue.js project?

Often developers choose what they're familiar with. If you're primarily a Laravel developer, for example, I'll bet Laravel will be first to your mind when planning a new project.