Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Passing variable within string to TemplateTag?

Is it possible to somehow render a variable within a string when passing it into a template tag?

This is what I would like to do:

{% my_template_tag src="images/brand/{{ image_name }}.jpg alt="{{ image_name }} loading="lazy" %}

Or is the only way to rewrite the template tag to take in `*args` and then do something like this?

{% with src='images/brand/'|add:image_name|add:'.jpg' %}
#tag info here
{% endwith %}

​

/r/django
https://redd.it/1c7l3l6
Django-middleware based inventory management database.

Hello. I'm a newbie looking to do a university project. It involves an inventory management database that will have an interactive front end, with simplified functionality. The front end will focus on practicality and not optimization or style, it's there just for the interactivity with the data in my database.

I'll be doing a presentation on my laptop, so hosting the website on localhost is a viable option at this time of the post. I am also thinking of dockerizing the final product.

I'm currently looking into the type of stack I'll need to pull this off. Thus far, I've picked :

-Postgresql for the database

-Nginx for hosting

-Django to connect my database to the front end

-Html, CSS, and vanilla JavaScript for the front end, since I have no experience with JavaScript at all.

I've read I can also use Django's built in local hosting capabilities for my project, so I can skip apache / nginx and another http gateway. The most important thing for me is for the project to be doable and not have an impossible stack of technologies I need to learn in a couple of months. I have experience with python in automation, which is why I picked

/r/django
https://redd.it/1c7ovk7
Friday Daily Thread: r/Python Meta and Free-Talk Fridays

# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

## How it Works:

1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

## Guidelines:

All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.

## Example Topics:

1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟

/r/Python
https://redd.it/1c7ir92
Who are the best Flask Gurus/Experts you know

I'll start with Miguel Grinberg

/r/flask
https://redd.it/1c7rng5
Celery Worker, Beat & Redis - Best Practce in Production

Hello everyone,


I recently had an issue with my celery worker and beat, notifications stopped getting sent, I had to rebuild the docker images to get them to work.


The Issue:

After the rebuild, stale notifications started getting sent, including those that had already been sent before


My Question:

Are there recommended best practices for configuring Celery worker, beat and redis to prevent such an issue?

What would you generally recommend in setting up these services?

/r/django
https://redd.it/1c7snjq
I used Flask to build this microblogging site in 6 hrs! It keeps your brain sane.

I grew tired of platforms like X and YouTube, noticing how they contribute to the decline of attention spans and critical thinking skills among my friends and others online. Keeping users hooked earn them a profit, not us.

NoHush is something where people don't stay confined within their own echo chambers. This is just a concept prototype, nothing fancy, but it gets the job done. It's UI is very brutalistic.

Special Feature is that you can share a post, and only that post will be shown, no distractions in between.

https://preview.redd.it/slnpqsubsevc1.png?width=456&format=png&auto=webp&s=eb97b3d3393acf4476fcef1cc0464df801f6677f



/r/flask
https://redd.it/1c7szye
Django Scheduler

I have implemented a custom calendar for my Django application using Django Scheduler. So I have this edge case where I need to implement calendar blocking for unavailable days can be for some hours in a day or a few days. I am trying to get a workaround for this.

/r/django
https://redd.it/1c7v5pd
Discussion Are there specific technical/scientific breakthroughs that have allowed the significant jump in maximum context length across multiple large language models recently?

Latest releases of models such as GPT-4 and Claude have a significant jump in the maximum context length (4/8k -> 128k+). The progress in terms of number of tokens that can be processed by these models sound remarkable in % terms.

What has led to this? Is this something that's happened purely because of increased compute becoming available during training? Are there algorithmic advances that have led to this?

/r/MachineLearning
https://redd.it/1c7pzf0
Hiring a Django back-end only dev

I have minimal experience with Django although I am able to recognize core functions due to some experience with Flask. I also have some experience with html/css/vanilla js.

I am have been in talks with a good backend Django developer who has minimal knowledge of FE development. Although I am confident I could develop the solution myself, I do not currently have the skills to develop at the speed that is required to produce an MVP.

However, my doubts stem from this developer's lack of experience with FE work. I thought I could just slap on a pre-built template like Metronic after the back-end views and models are complete but I am realizing this will still require a ton of work to configure, remove unused code, add graphs, tables etc etc. Am I overreacting or would it be smart to just hire another FE developer to assist with this or hire someone who has experience with both Django BE and Django templates?

​



/r/django
https://redd.it/1c833hd
Ruff 0.4.0 just dropped, with a faster parser and a new language server

Release notes here, seems to be a 20-40% improvement around the board.

This version features a new hand-written parser (rather than a generated one) that is much faster and offers better error messages. It also comes with a new rust-native language server inspired by rust-analyzer, that is multithreaded. I think they’re challenging Pylance’s throne, wouldn’t be surprised if the team goes after type checking next.

/r/Python
https://redd.it/1c7v2ax
FastAPI vs Flask vs Django

/r/flask
https://redd.it/1c82000
Project: An Interactive Python Dashboard For Data Storytelling UN Food Security

Python’s Plotly Dash is a powerful tool for creating interactive data visualizations. As a Comp Sci professor, I use it extensively for interactive dashboards.

Its usefulness lies in its ability to create web-based applications directly from Python code, without the need for additional web development skills.
Using UN food security data, let me show you an example of how you can create an interesting and useful Python Plotly dashboard that tells a data story using:

* **A bubble chart:** with variable-sized markers, a bubble chart can represent the severity of undernourishment within a given country. Each bubble visually represents the scale of undernourishment.
* **A horizontal bar chart:** with its rigid organized structure, a horizontal bar chart provides a clear ordered list that emphasizes the 10 most undernourished countries by percentage of population.
* **A dropdown menu:** by Year, allowing the user to see the changing story over a period of time.

These two data visualizations offer a dual perspective on the global picture of undernourishment: one that is geographically broad and another that is focused and comparative.

***Here's a step-by-step project on how to put this all together.***

FREE ARTICLE:

[https://johnloewen.substack.com/p/combining-data-visuals-an-interactive](https://johnloewen.substack.com/p/combining-data-visuals-an-interactive)

​

​

/r/Python
https://redd.it/1c7tkg1
Anaconda install taking a long time. Frozen?

Hello,

Trying to do a little training course and it has me installing Anaconda. It has been on Setting up Base environment for over an hour now. Last step reads "preparing transaction...working...done"

And it has not moved. Looking in task manager every now and then the cpu% goes up to like .5% then back down on the installer. 2 _conda remain at 0%

Have never had an issue installing anything before

/r/Python
https://redd.it/1c88588
Please link me some flask website examples.

I am trying to wrap my head around flask's capabilities. I am looking for live examples of websites using flask mostly by itsself with html/css but without javascript or with hardly any javascript or any other programing languages besides python. Huge bonus points if the code is open source.

/r/flask
https://redd.it/1c8aysj
Connecting Django to an existing database

Hey, so i want to create a simple web-ui for an existing database. It's a Flask page now but for learning purposes I want to move it to Django and now I'm stuck on 1 little thing. That database. It already exists and has quite a bit of data and no id column (as I know Django creates one). It also gets filled with more data by another program.

I'm not sure where to start with this as it would be very nice if it didn't ruin the existing database..

I don't mind reading documentation but I just don't really know what to look for so some key words or functions or whatever to search for would be very helpful already.

I can't be the only one wanting to do this.

/r/djangolearning
https://redd.it/1c86aec
FastAPI vs Flask vs Django

/r/django
https://redd.it/1c81zc3
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

/r/Python
https://redd.it/1c8bxz5
Been stuck on an error for a couple of days now - "AttributeError: 'NoneType' object has no attribute

Hello all,

I'm - trying to - make a website that incorperates a flask to do list app.
Following this tutorial.

Everything has gone fine but I'm about 13mins in video 5. I'm at the point of POST to my mongodb but get an error. I understand the something isn't defined correctly but the code is the same the video and his adds to the db just fine?

The error

My code

Any help is really appreciated

/r/flask
https://redd.it/1c82l6u