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
Help me how to structure a model for a Django project.

I want to replicate https://www.sporcle.com/games/g/worldflags this quiz web app to have a better grasp on Django. I will be using react on frontend and Django on backend. In model I will have ImageField for flag image and Textfield for user input to guess the country. So how do I structure model so that each image(flag) holds the text(country name) like dictionary (key:value) i.e key=flag of usa , value=USA Or how do I do it. Thanks.

/r/django
https://redd.it/1c70s3y
Add Stripe subscriptions to Django in 7 minutes 💵

Hi fellow Django-ers🐎

I wrote a short guide showing how to add Stripe subscriptions to Django extremely quickly - using as little code as possible.

The guide includes local webhook testing and uses Stripe's client-only checkout and customer portal.

If you're interested, here's the post: Add Stripe subscriptions to Django in 7 minutes 💵

I hope that you're having a good day. I'll answer any questions quickly.

https://preview.redd.it/ogjyesipl8vc1.png?width=704&format=png&auto=webp&s=e8c17914d5827f33084772c09153f675aaeed6a1

​

/r/django
https://redd.it/1c72zol
Open Sourcing a Python Project the Right Way in 2024

I recently open-sourced a package and the tooling was a bit of a struggle. I decided to write down the steps & all the tools needed to open-source a Python package in a scalable way that invite users and contributors.

https://jonathanadly.com/open-sourcing-a-python-project-the-right-way-in-2024

Happy to hear your feedback!

/r/Python
https://redd.it/1c70x8m
Has PyPI ceased all support?

Does anyone know what’s going on behind the scenes of PyPI (who maintains `pip install`)? It seems like they’ve stopped processing support tickets over a month ago.


I’ve hit the data limit for my package [PyBoy\](https://github.com/baekalfen/pyboy), and I immediately posted a ticket to get the limit increased (as others have successfully done). But after more than a month, and several attempts at contacting the support team, I’ve heard nothing back, and I’ve run out of options.


Does anyone know what’s happening, or how to get a comment from PyPI?


My ticket is this one: https://github.com/pypi/support/issues/3757

/r/Python
https://redd.it/1c6y1pi
PyPDFForm now lets you create widgets without Acrobat

Hello (https://www.reddit.com/r/Python/)! Earlier this year I made a post about my open source project PyPDFForm and got some really nice feedbacks from you guys.

I have been since then continuously working on it and I'd love to share you two really cool features that were newly added to the library.

The first one is, like what the title says, the library finally supports creating a subset of widgets through code now. One of the previous hard dependency for PyPDFForm was that it requires a PDF template that was prepared using another tool, namely Adobe Acrobat or some web based ones like DocFly. Well now, at least for text field, checkbox, and dropdown, you can do it through plain Python code. I personally find this a huge milestone of the project and if you are interested in this new feature checkout the documentation here.

The second new feature, which is actually not quite new because this was how PyPDFForm worked back in its ancestral stage, is that now you can fill a PDF form "in place", meaning when you fill it this way, the output PDF will look like as if it's filled manually. The reason why this got removed was because of a bug related to text field, where

/r/Python
https://redd.it/1c7aioh
+3 years of Django-only, and why I might not have gotten it all wrong.

I'm back with an update. Quick recap, back in November I wrote a message about how, after 3 years of Django-only, I found out I was creating MPAs (MultiPageApplications) and that there was also something called SPAs (SinglePageApplications), which require using a different frontend framework. Always late to the party, I had no clue.

In the meantime, I have an SPA demo online, django-react.com, made with Django in the back and ReactJS in the front. Feel free to take a look and ask me anything about what you see (it has registration, message board with ratings | pin | follow, account settings and an internal wallet to play around with tokens).

I would like to share my experiences, but there is a problem. Making the app forced me to deal with APIs (using APIView), Serializers, Cookies (vs Tokens), local and global States, and other complicated stuff, but most of it I probably don't really understand. And although I got it all to work, it shows strange behavior in some functionalities, which tells me I got some things wrong. So I can't write anything technical, instead, I'm going to try to explain the differences that stand out for me, in a way that

/r/django
https://redd.it/1c7cj3a
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