How to build an alternate Django admin in only 10 years
https://kodare.net/2024/09/03/admin-replacement.html
/r/django
https://redd.it/1f80m8v
Is there any plugin or Django app like this?
Supposing you have multiple users on your website and they receive points for doing something (posting, writing reviews, anything you choose to) and there are a few groups of users, each group having different rights and privileges on your website and the users are upgraded or downgraded to different groups based on accumulated points.
How to do this in Django? Is there any plugin or app helping you with this? If you just need to use pure Django then how this should be done?
Thank you in advance!
/r/djangolearning
https://redd.it/1f7s2gr
Please help us test new Flask deployment tooling
Hi,
I work for Canonical, the creators of Ubuntu. We have been working on some new tooling to make it easier to deploy Flask applications in production using Kubernetes. This includes tooling to create Docker images as well as tooling to make it easy to connect to a database, configure ingress and integrate with observability. We would love your help and feedback for further development. We have a couple of tutorials:
[Creating a production ready Docker image](https://documentation.ubuntu.com/rockcraft/en/latest/tutorial/flask/)
Deploy a Flask App on Kubernetes
Please share any feedback you have. We are also running user experience research which takes about an hour to complete. Please let us know if you are interested (DM me or comment below). Thank you!
/r/flask
https://redd.it/1f7tj1m
Deploying on Choreo.dev?
Hi Guys,
I am testing out different options for hosting my django + postgresql + react application. I found https://choreo.dev/ very convenient because i can manage all parts of the application on one dashboard instead of using 3 different providers.
However, it makes me a little suspicious that you can hardly find anything about choreo on the internet + the documentation is also not that extensive.
Do any of you have experience with the provider, and if so, what do you think?
/r/django
https://redd.it/1f7yhrx
Web scraping with GPT-4o: powerful but expensive
Hey folks,
So I've been messing around with OpenAI's new structured outputs feature and decided to build an AI-powered web scraper. Thought I'd share some of the cool (and not so cool) stuff I found.
**The Good:**
* This thing can parse some pretty complex tables. I threw a 10-day weather forecast at it with all sorts of nested data, and it handled it like well.
* It's smart enough to figure out merged cells and hidden data in the HTML.
**The Bad:**
* Wikipedia tables with combined rows? Yeah, that broke it.
* Asking it to give XPaths directly was a mess. Had to do some workarounds.
**The Ugly:**
* GPT-4o is expensive! Spent $24 in two days just messing around.
I made a quick demo with Streamlit if anyone wants to check it out: [https://orange-resonance-9766.ploomberapp.io](https://orange-resonance-9766.ploomberapp.io)
Source code's on GitHub if you're curious: [https://github.com/edublancas/posts/tree/main/ai-web-scraping](https://github.com/edublancas/posts/tree/main/ai-web-scraping)
Anyone else played with AI for web scraping? What's been your experience?
P.S. If you want the full nerdy details, I wrote a blog post about it: [https://blancas.io/blog/ai-web-scraper/](https://blancas.io/blog/ai-web-scraper/)
/r/Python
https://redd.it/1f7g0t9
pytest vs unittest?
I keep reading from Django’s official site to use unittest, but I’m reading more about pytest and find some aspects really interesting and intuitive. What does the community at large prefer?
/r/django
https://redd.it/1f7maoe
Why not just get your plots in numpy?!
Seriously, that's the question!
Why not just have simple plot1(values,size,title, scatter=True, pt_color, ...)->np.ndarray
function API that gives you your plot (parts like figure and grid, axis, labels, etc) as numpy arrays for you to overlay, mask, render, stretch, transform, etc how you need with your usual basic array/tensor operations at whatever location of the frame/canvas/memory you need?
Sample implementation: https://github.com/bedbad/justpyplot
# What my project does?
Just implements the function above
When I render it, it already beats matplotlib and not by a small margin and it's not the ideal yet:
Plotting itself done in vectorized approach and can be done right utilising the GPUs fully
plot1, plot2 .. plotN is just dependency dimensionality you're plotting (1D values, 2D, add more can add more if wanted)
Target Audience? What it Compares against?
Whoever needs real-time or composable or standalone plotting library or generally use and don't like performance of matplotlib [1, 2, 3\]
I use something similar thing based on that for all of my work plotting needs and proved to be useful in robotics where you have a physical feedback loop based on the dependency you're plotting when you manipulating it by hand such as steering the drone;
/r/Python
https://redd.it/1f7jfgd
Anatomy of a Textual User Interface
Hi folks,
I wrote about building an AI Chat interface with Python and Textual.
https://textual.textualize.io/blog/2024/09/15/anatomy-of-a-textual-user-interface/
/r/Python
https://redd.it/1f79kwq
Smartcut: Super fast cutting and trimming of videos
What My Project Does
Smartcut is to my knowledge the most robust open-source implementation of frame accurate video cutting without recoding, a.k.a smart cut, smart encoding, smart render, etc.
It uses PyAV and libavcodec (ffmpeg internals) to encode a small part of the video near the cutpoints and then uses libavformat to stitch the recoded segments and parts of the original video back together into a whole video.
https://github.com/skeskinen/smartcut
Target Audience
This project is for people who want to cut videos really fast from the command line. This could be useful e.g. as part of a script that goes through a directory and quickly cuts off some part of the videos. It could also be used as a part of a video editor project, like I've done in my GUI video editor project.
It is also one of the largest available projects that uses PyAV (the pythonic bindings for libav project) and really showcases the awesomeness of the library. I also contributed 4 patches to PyAV and the maintainer was really cool to work with.
Comparison
The github page has a pretty nice list of related projects: https://github.com/skeskinen/smartcut?tab=readme-ov-file#other-projects
The most obvious comparison is to lossless-cut which is a popular open-source video editor written in TypeScript and Electron
/r/Python
https://redd.it/1f767df
Looking to Collaborate on Django Projects or Start Something New
Hey everyone!
I’ve completed a few Django projects, including a library system, blog platform, and a face and plate recognition attendance app using RabbitMQ. I’m experienced with Django, Celery, RabbitMQ, and both relational and non-relational databases.
I’m looking to collaborate on new projects to strengthen my GitHub portfolio. If you have any project ideas, need an extra hand on existing projects, or want to brainstorm something cool, let’s connect!
Thanks!
/r/django
https://redd.it/1f748vp
IAAS or similar cloud computing service to deploy a MVP
Hi everyone, I'm developing a MVP software product and I'm looking for the best option relation between freemium and features. Thanks
/r/django
https://redd.it/1f6t3x0
Hey, I’m new to Flask and have a question. When I have a flask server running the URL never works and always says ‘Not found’ even though its running. Any help?
/r/flask
https://redd.it/1f6jhh3
Trending Django packages in August
https://django.wtf/trending/?trending=30
/r/django
https://redd.it/1f6nait
Developing flask backend
Hey guys, hope y'all are doing well.
I'm developing a flask backend to run a segformer and an stable diffusion model. I got both of them off of hugging face. I tested everything out in Jupiter and they work fine.
My tech stack is currently a next/reactjs frontend, SupaBase for auth etc, stripe for payments and flask as an API to provide the key functionality of the AI.
I'm getting started with the flask backend, and although I've used it in the past, this is the first time I'm using it for a production backend. So, logically, my questions are:
-Do I need to do something for multi threading so that it can support multiple users' requests at the same time?
-Do I need to add something for token verification etc.
-Which remote server service provides good GPUs for the segformer and stable diffusion to run properly?
-Any other key things to look out for to avoid rookie mistakes would be greatly appreciated.
I already installed waitress for the deployment etc and I was wondering whether I should dockerize it too after it's developed.
/r/flask
https://redd.it/1f6nwxt
UPD with code: help, flask server’s link doesn’t show anything. Everytime I try to open it, it shows ‘not found’.
/r/flask
https://redd.it/1f6mqnp
Using HTMX with Django is much easier than I thought!
I have recently given HTMX a try halfway through working on a Django project that needed dynamic content loading. It took me so long to give it a try because I thought that it would be hard to learn, but I was sooooo wrong. 😅
So it turns out that to add dynamic content loading all I had to do is:
1. Make a partial template of what I wanted to dynamically load.
2. Add HTMX to project
3. Add HTMX attributes to HTML
For this project, where I dynamically loaded available properties based on selected dates and number of guests I used these 3 HTMX attributes on my form element:
1. hx-get : to make an asynchronous HTTP GET request when an event is triggered
2. hx- target : to select the target element where we want to load the dynamic content.
3. Hx-swap: defines how the content retrieved via an HTMX request should be inserted into the target element on the page.
I found two things a little difficult to figure out:
1. Choosing the correct swap attribute: at first I tried outerHTML, but after some trial and error, I realized that innerHTML was the right choice.
1. Detecting HTMX requests in my Django view: It took me some
/r/django
https://redd.it/1f80vnq
Generators underused in corporate settings?
I've worked at a couple of places that used Python. And I've rarely seen anyone regularly using the yield
keyword. I also very rarely see people using lazy "comprehensions" likefoo = (parse(line) for line in file)
bar = sum(postprocess(item) for item in foo)
And so, I'll use these features, because to me, they simplify things a lot. But generally people shy away from them. And, in some cases, this is going to be because they were burned by prior experiences. Or in other cases it's because people just don't know about these language features.
Has this been your experience? What was the school of thought that was in place on your prior teams?
/r/Python
https://redd.it/1f7zh22
Spyder 6 IDE Released
Spyder 6 has been released. The Spyder IDE now has standalone installers for Windows, Linux and Mac. Alternatively it can be installed using a conda-forge Python environment:
https://github.com/spyder-ide/spyder/releases
/r/Python
https://redd.it/1f7w2rn
Looking for fellow learners
TLDR: If you are interested in learning and then building in Django, Please DM me and we can start ASAP. I am a beginner in Django.
I am looking for one to two people to learn and practice Django together. This way we all can learn faster and build something cool together.
Requirements:
Must be serious learners who want to learn quick and start building.
Must be proficient with programming in general and have decent knowledge of Python. Quick Learner and positive mindset.
Plus Points: If you are experienced.
About Me: I am a software Engineer proficient in C++ & Python, Strong knowledge of Programming & DSA. Have almost 2 YOE.
To people who have commented: I have zero experience with Django, know basic things like views, models, app, users, admin etc. but would like to start from square 1 which i think should take like a week to get done with basics and jump on to building. Just telling it so that you have clear idea about my Django Knowledge and what to expect.
/r/django
https://redd.it/1f7awk6
Anyone made the switch from ASP.NET Core?
I'm a .NET developer by daytrade, and I'm starting side projects from time to time. Usually it's been Node.js/Go/ASP.NET, but I've never done Django yet. I'm just not a big Python user in general.
However, it now looks like I have to build an admin panel by myself for a side project I've just started, and Django entered my mind as it's got one by default. It looks like Django + DRF is sort of a ASP.NET/Spring lite-edition, so I'm looking to see some feedback if anyone has actually moved from ASP.NET to Django, or just used both and have some feedback to share.
One thing I'm kind of suspicious about is the performance. ASP.NET is what, 10x faster than Django? However I know it probably won't make a real difference, but seems a shame if there is no real benefit to using Django.
/r/django
https://redd.it/1f7ezda
Tuesday Daily Thread: Advanced questions
# Weekly Wednesday Thread: Advanced Questions 🐍
Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.
## How it Works:
1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.
## Guidelines:
* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.
## Recommended Resources:
* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.
## Example Questions:
1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the
/r/Python
https://redd.it/1f7lwin
Django modal actions
Hey! 👋
I'm excited to share my new package: django-modal-actions. it allows you to create custom actions that open in a modal dialog, enhancing the user experience and functionality of your Django admin.
/r/django
https://redd.it/1f7cok2
Is Django Still Relevant for Backend Jobs?
Hi Djangonauts!
I'm a junior CS student with some experience in Django (intermediate functionality, needs frontend work). While I enjoy using Django, I'm concerned about landing a job with it after graduation. Many postings seem to focus on C# and .NET
My questions are:
Is Django still a valuable skill to learn for backend development positions?
Would focusing on C# and .NET offer better job prospects, considering the current market?
My dilemma:
I'm unsure if I should continue building my Django skills or switch gears to C# and .NET for better job security.
I'm feeling some pressure to upskill and avoid the pitfalls of job seekers lacking the right skills.
so I'm trying hard and pushing through burnouts, trying to upskill in order to strengthen my capability and candidacy.
/r/django
https://redd.it/1f76jbk
Can anyone help me complete my tracker server (BitTorrent Protocol)
I am trying to create my own private bittorrent protocol which I will use for load balancing static data in the web server to visitors. I have app.py written, among other things, but what is weird to me is that I can initiate the magnet url download process, but then no data is transferred. Additionally, I am able to download .torrent files.
This is the repository, could someone take a look at it and tell me what they think? I'm planning to make this a free and public web forum.
/r/flask
https://redd.it/1f79sre
Django Course or Book
hi guys . i'm new to django framework after i learned the basics of python and DSA , now i need a friendly beginner course or book not just to teach me how to use this feature in django but why i need it and thanks.
/r/django
https://redd.it/1f72eg1
Something really really weird happens...
So my base template is (deleted link to the CSS spreadsheet due to debugging):
https://preview.redd.it/mwpy7k4r29md1.png?width=422&format=png&auto=webp&s=3adfe342a4ff8fc77b3c3eb71ffcc08950e67224
https://preview.redd.it/d0oyqtj139md1.png?width=708&format=png&auto=webp&s=74e061b7cab2a7e49053f33e00d5732f1b5f5dc5
https://preview.redd.it/5awcger739md1.png?width=708&format=png&auto=webp&s=f23df724d6f3c88dfc96ffe69f194febef3e162e
\^ And then I have this template with internal CSS. And when I extend it (pic 2), it doesn't render at all. When I write a text to these divs, they only expand to the point to accomodate that text.
But when I'm not extending it (3), then it renders fine, like it's supposed to render.
Anyone?
/r/django
https://redd.it/1f6n2p2
Table goes blank when page is refreshed...shows
is a list of lists being passed to the HTML file used to populate a table. When I run the program and open the page for the first time, the table populates just like it's supposed to. But if I refresh the page in the browser, the table goes blank except for the headers. Why is this happening?
from flask import Flask, rendertemplate
from getshows import getshows
import pandas as pd
from time import sleep
filename = "Output.csv"
df = pd.readcsv("ListedVenues.csv")
# create an empty dictionary to hold the show information
showstonight = {
"venue": ,
"show": ,
"date": ,
}
# make the API calls to get show information and store it in the showstonight dictionary
for index, row in df.iterrows():
venue, bands, date = getshows(row"Venue
/r/flask
[https://redd.it/1f6spgz
Monday Daily Thread: Project ideas!
# Weekly Thread: Project Ideas 💡
Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.
## How it Works:
1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.
## Guidelines:
* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.
# Example Submissions:
## Project Idea: Chatbot
**Difficulty**: Intermediate
**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar
**Description**: Create a chatbot that can answer FAQs for a website.
**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)
# Project Idea: Weather Dashboard
**Difficulty**: Beginner
**Tech Stack**: HTML, CSS, JavaScript, API
**Description**: Build a dashboard that displays real-time weather information using a weather API.
**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)
## Project Idea: File Organizer
**Difficulty**: Beginner
**Tech Stack**: Python, File I/O
**Description**: Create a script that organizes files in a directory into sub-folders based on file type.
**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)
Let's help each other grow. Happy
/r/Python
https://redd.it/1f6syvh
Hosting a Django website that supports a few thousand requests per minute
We're working on a site for an event and we're using a template that uses Django, though none of us is an expert in it. At the beginning of the event we expect a few thousand requests per minute, especially in a mini game that uses post requests. The template comes with files asgi.py and wsgi.py to run it with gunicorn, and as I understand asgi is async so it should be better to control concurrent connections.
So far we tried hosting it on Heroku using a postgres database and trying up to 25 standard dynos, which I feel like it's a lot, and with a load of 100 virtual users testing it with k6 we still got response times of around 2 seconds for those post requests. We also tried pythonanywhere using the default sqlite database and the results were worse.
We're not sure where the bottleneck is exactly. We thought it was a matter of the CPUs not keeping up, but we also tried running it on my main PC and we were also getting times of about 2 seconds with 100 VUs in k6, and the CPU was just running at 50% (though on that one we didn't
/r/django
https://redd.it/1f6k3rk
Taming the beast that is the Django ORM - An introduction
https://www.davidhang.com/blog/2024-09-01-taming-the-django-orm/
/r/django
https://redd.it/1f63g68