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 on Flask deployment in Render Web Service

Hello everyone,

Im a noob in Flask. And i have never deployed a web app. Im currently working on a project, which allows bulk uploading to the app. And later on, the client can use it with relative ease, helping his workflow.

I could push my commits up to a certain point. And it kept failing with the same messages: **sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "....." (10...), port ... failed: FATAL: remaining connection slots are reserved for roles with the SUPERUSER attribute**

(at first it was a different message, then it repeated became this message)
Details:

* Flask
* TailWind CSS
* attempted both gunicorn and recently waitress, with no difference in recent result.

I would post my code, but I dont know which part would help. Its quite big already.


Example of commands I ran:

gunicorn -b [0.0.0.0:9000](http://0.0.0.0:9000) 'wsgi:app' -t 300 --keep-alive 300



/r/flask
https://redd.it/1kc0p28
Syd: A package for making GUIs in python easy peasy

I'm a neuroscientist and often have to analyze data with 1000s of neurons from multiple sessions and subjects. Getting an intuitive sense of the data is hard: there's always the folder with a billion png files... but I wanted something interactive. So, I built Syd.

Github: https://github.com/landoskape/syd



What my project does

Syd is an automated system for converting a few simple and high-level lines of python code into a fully-fledged GUI for use in a jupyter notebook or on a web browser with flask. The point is to reduce the energy barrier to making a GUI so you can easily make GUIs whenever you want as a fundamental part of your data analysis pipeline.



Target Audience

I think this could be useful to lots of people, so I wanted to share here! Basically, anyone that does data analysis of large datasets where you often need to look at many figures to understand your data could benefit from Syd.

I'd be very happy if it makes peoples data analysis easier and more fun (definitely not limited to neuroscience... looking through a bunch of LLM neurons in an SAE could also be made easier with Syd!). And of course I'd love feedback on how it works to improve

/r/Python
https://redd.it/1kc3vk6
Creating & Programming Modern Themed Tables in Python using ttkbootstrap Library

I have created a small tutorial on creating a table widget for displaying tabular data using the Tkinter and ttkbootstrap GUI.

Links:

1. Youtube Tutorial : Creating & Programming Modern Themed Tables in Python using ttkbootstrap Library
2. Website/SourceCode : Creating GUI Tables in tkinter using Tableview Class

Here we are using the Tableview() class from the ttkbootstrap to create Good looking tables that can be themed using the ttkbootstrap Library.

The tutorial teaches the user to create a basic table using ttkbootstrap Library , enable /disable various features of the table like Search Bar, Pagination Features etc .

We also teach how to update the table like

1. adding a single row to the tkinter table
2. adding multiple rows to the table,
3. Deleting a row from the tkinter table.
4. Purging the entire table of Data

and finally we create a simple tkinter app to add and delete data.



/r/Python
https://redd.it/1kc60ih
I open-sourced a .po file management system for Django – feedback welcome!

Hi there,

I just open-sourced a tool I built to make managing `.po` files in Django much easier.

The system pushes your translation strings to a cloud-based UI where you can manage and translate them more easily. When you're ready, you can pull the updated translations back into your `.po` files using a simple [`manage.py`](http://manage.py) command.

Django doesn’t have a great native way to manage `.po` files, so I created this to fill that gap. The project is still evolving, the API and UI could use some polish, but it’s already usable and might save you time.

* Website: [https://dj-polyglot.com/](https://dj-polyglot.com/)
* App repo: [https://github.com/Thutmose3/dj-polyglot-app](https://github.com/Thutmose3/dj-polyglot-app)
* Library repo: [https://github.com/Thutmose3/dj-polyglot-lib](https://github.com/Thutmose3/dj-polyglot-lib)

Would love to hear your thoughts or feature suggestions!

/r/django
https://redd.it/1kc1vyd
How to add a unique constraint on a model using only the date part of a DateTimeField?

I have a Django model like this:



class MachineReading(models.Model):
machine = models.ForeignKey(VendingMachine, ondelete=models.CASCADE)
worker = models.ForeignKey(settings.AUTH
USERMODEL, ondelete=models.CASCADE)
counter = models.DecimalField(maxdigits=12, decimalplaces=2)
# ...
created = models.DateTimeField()




I want to ensure there's only one reading per machine per day, but I don’t want to add a separate DateField just for the date part of the created field. Is there a clean way to enforce this at the database level using Django's Meta.constraints or any other approach?

Thanks!

/r/django
https://redd.it/1kccn58
What is you method of designing/creating a python script (top -> bottom or bottom-> top )

This is most likely a discussion of personal preference (I believe) and can also be had regarding any widely available language, but within Python specifically I am interested in peoples preferences here. I spent most of the time in college as an engineering student working in MATLAB, and there was a common workflow in defining functions and such that I would often use to solve any problem that just made sense for me. Moving more and more into understanding Python (as well as other languages) I am curious what others prefer to do in other languages. For example, do you prefer to consider your problem, then start by creating the highest level of code than would then rely on functions and classes not yet defined or maybe even conceptualized, or, do you think about how you want to define the "lowest" level functions and build upwards. There is likely some term to describe this question that I am not immediately familiar with, but again, I am really curious about the general work flow most people find themselves using within Python.

/r/Python
https://redd.it/1kci456
Need Guidance

Hello! I'm new to Python and Flask, and I have no idea how to build projects in Flask. Yesterday, I just learned how to use jsonify to display JSON output from a single function. Can someone help me understand how a full Flask project works and how different files interact after setting up the project structure?

/r/flask
https://redd.it/1kbzgw2
Added live streaming on my Django project

I recently added live-streaming to my Django project would like for folks to check it out. Has live comment updating and everything.

Uses:
Aws IVS
Vastvp video player
Vastcomments

Once you create an account go to this link and start a livestream:

https://vastvids.com/live/create_livestream/

/r/django
https://redd.it/1kcf05s
Frontend Help

I am super new to Django (and web dev overall) and keep being told that Django is backend only. There's advice on plenty of different front end options to incorporate, but sounds like I would need to learn a whole new language (Javascript) and some specific framework (Vue,React, etc).

If my goal is to merely display bar graphs and charts for some sport stats- what is the simplest frontend I would need? I know there's Django templates but my research shows that wouldn't be great for graphs (especially if I wanted them to be interactive) - Is that a correct assumption? Has anyone used Django templates for interactive graphs and charts?

I feel very confident with my overall python skills so I think I can figure out the backend portion of things, but don't know what the line of demarcation is for needing a frontend or what is a super low level frontend framework that could.

I've seen options such as ChartJs and Bootstrap- are these good implementation options? Would it be better to just have straight HTML files in the template folders and have Javascript and CSS to compliment them? Or are all those band aid solutions and its

/r/djangolearning
https://redd.it/1kbtlvn
For multi-model fetch and pandas resample

I'm relatively new to Django, and I will admit, I've been struggling on how to get this to work a while. Currently, I have left this feature out of the dashboard out till a future version, but it still bugs me.

class Palworldplayermetrics(
models
.
Model
):
    id = models.BigAutoField(primary_key=True)
    player = models.ForeignKey('Palworldplayers',  models.DO_NOTHING, related_name='playerinfo', blank=True, null=True)
    palplayermetrictype = models.TextField(blank=True, null=True)  # ALWAYS PING
    data = models.FloatField(blank=True, null=True)
    insert_time = models.DateTimeField(blank=True, null=True)
    server = models.ForeignKey(Palwordservers, models.DO_NOTHING, blank=True, null=True)
    objects = DataFrameManager()
    class Meta:
        managed = False
        db_table = 'palworldplayermetrics'
        app_label = 'databot'

class Palwordservers(
models
.
Model
):
    name = models.TextField(blank=True, null=True)


/r/django
https://redd.it/1kcjenx
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/1kcnhrk
How to deploy your flask application.

Hi guys, it's me again:) after a few days of work with the flask wiki community, we've come up with a little tutorial on application deployment!

I hope it can help you, any feedback, error reporting etc is welcome as usual!
https://flaskwiki.wiki/rs/deployment-guide

We also have a github now where you can participate in the wiki yourself! We are and always will be free, I really hope that all together we can make flask more popular, give it the light it deserves.!!
https://github.com/Ciela2002/flaskwiki/tree/main

/r/flask
https://redd.it/1kazu6h
Template strings in Python 3.14: an useful new feature or just an extra syntax?

Python foundation just accepted PEP 750 for template strings, or called t-strings. It will come with Python 3.14.

There are already so many methods for string formatting in Python, why another one??

Here is an article to dicsuss its usefulness and motivation. What's your view?

/r/Python
https://redd.it/1kch7hf
I just published an update for my articles on Python packaging (PEP 751) and some remaining issues

Hi everyone!

My last two articles on Python packaging received a lot of, interactions. So when PEP 751 was accepted I thought of updating my articles, but it felt, dishonest. I mean, one could just read the PEP and get the gist of it. Like, it doesn't require a whole article for it. But then at work I had to help a lot across projects on the packaging part and through the questions I got asked here and there, I could see a structure for a somewhat interesting article.

So the structure goes like this, why not just use the good old requirements.txt (yes we still do, or, did, that here and there at work), what were the issues with it, how some can be solved, how the lock file solves some of them, why the current `pylock.toml` is not perfect yet, the differences with `uv.lock`.

And since CUDA is the bane of my existence, I decided to also include a section talking about different issues with the current Python packaging state. This was the hardest part I think. Because it has to be simple enough to onboard everyone and not too simple that it's simply wrong from an expert's point of

/r/Python
https://redd.it/1kcumjf
I Made AI Powered Bulk Background Remover

What My Project Does
A desktop tool that removes backgrounds from multiple images in bulk using the rembg library.

Target Audience
Ideal for individuals or small businesses needing fast, unlimited, and offline background removal.

Comparison
Unlike most online tools, it’s completely free, offline, and has no usage limits. (This is exactly why I did this project)

Github



/r/Python
https://redd.it/1kclan0
Django tip Populating Databases With Dummy Data

/r/django
https://redd.it/1kcz7hk
Looking for intermediate/advanced level python courses for data analytics

I have foundational knowledge on pandas, NumPy, Matplotlib, Sci-kit learn, plotly SQL, SQLite, and PostgreSQL. Are there any courses out that that skip the basics and go straight into more complex projects? Or, do you have any other suggestions on how I can gain strengthen my skills? My goal is to become a data analyst. I am still undecided on what field/topic I am most interested in but I have good faith that I will figure it out on the way. I appreciate any wisdom you all have to share!

/r/Python
https://redd.it/1kco45y
What do you prefer Bootstrap or Tailwind?

I am from the "older" generation. We started with Bootstrap, and it worked for years without fail. The classes are easy to remember and clean.

Tailwind, on the other hand, looks really professional, modern, and sleek. I like the fonts and colours that come with the library by default, but I don't like having 3000 classes in my markup, and I am okay with writing custom CSS.

With that said, I am using Tailwind more and more now just because it looks so good without me having to add extra CSS. How about you? Django developers tend to still stick with Bootstrap or are we moving along into Tailwind?

/r/django
https://redd.it/1kcxe2x
Steps to learning deployment

Currently im using DO's App Platform to run my client's app. However I want to learn to deploy an app from scratch by myself. What are the steps I need to learn? Do I use docker on a vps or go some other route?

/r/django
https://redd.it/1kcy6ny