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
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions 🐍

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! 🌟

/r/Python
https://redd.it/1i1kdk3
Advice on Building a Scalable Backend for a Dynamic Content Platform? (I'm a total noob so any advice is greatly appreciated, thank you)

I’m working on a project that involves building a dynamic content platform with some pretty complex backend requirements. I want to make sure I approach this the right way and was hoping for some advice or insights from this community.

Here’s the general gist of what I need:

Dynamic Content Delivery: The platform will have a branching structure where users navigate through various levels, each dynamically populated based on specific metadata (e.g., tags, categories).
Database Scalability: The system will need to handle a growing database of assets (images, metadata, user submissions) that are retrieved based on user choices.
Admin Panel: I need a user-friendly admin interface to upload, tag, and manage content efficiently.
API Integration: The backend will need to serve content dynamically to a WordPress frontend via APIs.
Authentication: Secure login options, including third-party authentication (Google, Facebook, etc.).
Long-Term Growth: The system needs to be scalable to support thousands of entries and potentially high user traffic.

I’m considering technologies like Django or Node.js for the backend, paired with a relational database (e.g., PostgreSQL or MySQL). If you’ve worked on something similar or have any advice on structuring a project like this, I’d love to hear your thoughts.

Thanks in advance!

/r/django
https://redd.it/1i1l812
Develop web applications with wwwpy, which is scalable, customizable, and developer-friendly 🚀


This post announces the first installable version of wwwpy. It is still in its infancy, but I hope you will see the quality and direction of this Python framework for developing web applications.

Repository [https://github.com/wwwpy-labs/wwwpy](https://github.com/wwwpy-labs/wwwpy) 
Homepage https://wwwpy.dev/ 

Like any tool, libraries and frameworks have trade-offs. Some have poor trade-offs, limited strengths, and numerous weaknesses. The goal of wwwpy is to achieve an optimal trade-off: providing the best possible balance between ease of use and power. ⚖️

How do wwwpy achieve this? By utilizing all available technologies without restricting or obscuring access to them. With wwwpy, you can leverage pre-built UI components to rapidly build interfaces. Still, if you need more control, the browser's DOM, HTML, and CSS technologies are fully accessible. 🎨

At its core, wwwpy aims to ease access to technology rather than hinder it. For example, when you create a component, you're effectively working with standard HTML custom Web Components, extending familiar technologies rather than reinventing the wheel. 🛠️

What My Project Does

Develop web applications quickly, Python all the way down.

The vision of wwwpy:

Jumpstart Your Projects: With just a couple of commands, get a head start on building web UIs, allowing you to focus on coding and scaling your application.


/r/Python
https://redd.it/1i12yib
I created an opensource lightweight django-cookiecutter

Hi!

TLDR: I created a template to create typical Django projects faster. Details on how to use it in the repo.

I often (2-6 times a year) create Django projects. They always use Django-celery, DRF and connected to postgreSQL. Coupling these together always take \~1hr of my time.

To save these hours I created a Django template cookiecutter \- now setting up a Django app takes seconds instead of hours.

Template creates you a Django application with

1. Django-Rest-Framework
2. Django-celery-beat to do async jobs in the background
3. PostgreSQL as database
4. Everything dockerized

Why not use the official Django cookie cutter?

Because it is just too much. When I tried to use it it took more time to remove unnecessary staff - it contains bootstrap, all sorts of pluggable libraries - precommits, allauth, anymail etc...

I hope this might help someone :)

/r/django
https://redd.it/1i19nc2
I rewrote my programming language from Python into Go to see the speed up.

What my project does:

I wrote a tree-walk interpreter in Python a while ago and posted it here.



Target Audience:

Python and programming entusiasts.

I was curious to see how much of a performance bump I could get by doing a 1-1 port to Go without any optimizations.

Turns out, it's around 10X faster, plus now I can create compiled binaries and include them in my Github releases.

Take my lang for a spin and leave some feedback :)


Utility:

None - It solves no practical problem that is not currently being done better.

/r/Python
https://redd.it/1i1ppr7
I have 0 experience in Django but have to Interview Candidates. Help!

Hi every one I an working in a company where we have just received a project in Django or are about to. But no one in the company has experience in Django development.



So HR has given me the job of handling Django interviews as I am the only one who has some knowledge Django and python but no work experience.



Can u guys give me some Questions and coding exercises that I can ask the candidate to know if they are suitable for the job. I have not been told about if we have to hire Junior or Senior devs.


Thanks to all the answers.

/r/django
https://redd.it/1i1ssz1
R Transformer²: Self-Adaptive LLMs

Paper: https://arxiv.org/abs/2501.06252

Abstract

Self-adaptive large language models (LLMs) aim to solve the challenges posed by traditional fine-tuning methods, which are often computationally intensive and static in their ability to handle diverse tasks. We introduce Transformer², a novel self-adaptation framework that adapts LLMs for unseen tasks in real-time by selectively adjusting only the singular components of their weight matrices. During inference, Transformer² employs a two-pass mechanism: first, a dispatch system identifies the task properties, and then task-specific "expert" vectors, trained using reinforcement learning, are dynamically mixed to obtain targeted behavior for the incoming prompt. Our method outperforms ubiquitous approaches such as LoRA, with fewer parameters and greater efficiency. Transformer² demonstrates versatility across different LLM architectures and modalities, including vision-language tasks. Transformer² represents a significant leap forward, offering a scalable, efficient solution for enhancing the adaptability and task-specific performance of LLMs, paving the way for truly dynamic, self-organizing AI systems.

Blog Summary: https://sakana.ai/transformer-squared/

GitHub: https://github.com/SakanaAI/self-adaptive-llms

/r/MachineLearning
https://redd.it/1i1l8d4
Deploy React/Django in GCP Compute

Hi, did anyone have a detailed guide on how can I deploy my App using google compute? I have tried but unable to expose my app in port 3000 and 8000. Any help please. Thanks.

/r/django
https://redd.it/1i1oiwj
Running Django’s test suite for the first time problem

https://preview.redd.it/yikxryyv76de1.png?width=690&format=png&auto=webp&s=abb125ae95949ec2c4bcbef6c905f04bd1a003db

Hi. I found an instruction to run test suite for the first time here:
https://docs.djangoproject.com/en/dev/intro/contributing/
i have done everything written there but have some issues:
One of the tests (last on the screen) runs for a very long time and does not change its state
Can anyone suggest - what could be the problem?

/r/django
https://redd.it/1i1z193
I've Created a Python Library That Tracks and Misleads Hackers

Background

Hello everyone! A few months ago, I created a small web platform. Since I have many security engineer followers, I knew they would actively search for vulnerabilities. So, I decided to plant some realistic-looking fake vulnerabilities for fun. It was fun, and I realized that it can be actually very useful in other projects as well. I could monitor how many people were probing the platform while having them waste time on decoy vulnerabilities. Therefore, I've created BaitRoute: https://github.com/utkusen/baitroute

What My Project Does

It’s a web honeypot project that serves realistic, vulnerable-looking endpoints to detect vulnerability scans and mislead attackers by providing false positive results. It can be loaded as a library to your current project. It currently supports Django, FastAPI and Flask frameworks. When somebody hits a decoy endpoint, you can send that alarm to another service such as Sentry, Datadog, etc. to track hackers. Also, if you enable all rules, attackers' vulnerability scans become a mess with false-positive results. They'll waste considerable time trying to determine which vulnerabilities are genuine.

Target Audience

It can be used in web applications and API services.

Comparison

I’m not aware of any similar projects.



/r/Python
https://redd.it/1i208uo
Dash app down , 502 error randomly

I’ve deployed a dash app on one of my corporate servers (linux) and i have users complaining from application being down for no reason. (502 error)

Anyone has an idea about this issue ? maybe a tiemout from dash ?

THANKS

/r/flask
https://redd.it/1i21gni
Hard to master topics in Django

Recently I have been using Django quite alot I have about 2 years of experience in it now and I can almost always think of a solution in django when implementing new features, so I am starting to think that I am entering a comfort zone and not really learning new things.

So I wanted to get recommendations about features or changes that people may have struggled with and if I like something I may end up implementing it.

Thank you all for the suggestions.

/r/django
https://redd.it/1i22cpz
WASM-powered codespaces for Python notebooks on GitHub

What my project does

During a hackweek, we built this project that allows you to run marimo and Jupyter notebooks directly from GitHub in a Wasm-powered, codespace-like environment. What makes this powerful is that we mount the GitHub repository's contents as a filesystem in the notebook, making it really easy to share notebooks with data.

All you need to do is prepend 'https://marimo.app' to any Python notebook on GitHub. Some examples:

Jupyter Notebook: [https://marimo.app/github.com/jakevdp/PythonDataScienceHandb...](https://marimo.app/github.com/jakevdp/PythonDataScienceHandbook/blob/master/notebooks/02.08-Sorting.ipynb)
marimo notebook: https://marimo.app/github.com/marimo-team/marimo/blob/07e8d1...

Jupyter notebooks are automatically converted into marimo notebooks using basic static analysis and source code transformations. Our conversion logic assumes the notebook was meant to be run top-down, which is usually but not always true [2\]. It can convert many notebooks, but there are still some edge cases.

We implemented the filesystem mount using our own FUSE-like adapter that links the GitHub repository’s contents to the Python filesystem, leveraging Emscripten’s filesystem API. The file tree is loaded on startup to avoid waterfall requests when reading many directories deep, but loading the file contents is lazy. For example, when you write Python that looks like

with open("./data/cars.csv") as f:
print(f.read())

# or


/r/Python
https://redd.it/1i270co
What is the best way to ban someone's IP?

Long story short, I operate a golf wiki, and it's grown enough to have my first horrific and racist troll updating courses with wildly inappropriate things.

It's pretty clear that this person *doesn't realize your full IP is posted with any anonymous edit*.

Having never encountered this problem before, I'm trying to figure out an effective way of taking edit privileges away without the user trying to find a workaround.

First however, I need to know which IP to ban. I've been using **request.access_route** rather than **request.remote_addr** because it seems to be more complete, but I'm going to be honest that I'm not entirely sure whether that is necessary.

It seem like the best method would be to use **request.access_route**, but then to take the -1th list item from that list and ban that? Or should I simple ban the entire access route.

I don't want to accidentally ban the public library, but we don't exactly have access to mac addresses... so... I'm not entirely sure what to do.

Any advice from someone who is better informed on networking stuff?

/r/flask
https://redd.it/1i27y66
Apache or Nginx

What's better to use on Django project with mysql bd as a web-server, apache or nginx?

/r/django
https://redd.it/1i213fe
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1i2botq
Explore OSS built in the Flask ecosystem!

Hi r/flask ! I'm part of a small team building a new discovery tool for open source called **market.dev**. It's a way to easily search and browse what's happening in OSS - for projects, people, and resources. Here's the Flask ecosystem at a glance.

We built this because we wanted an ecosystem centric view of open source, auto-categorized and easily to keep up with. We also wanted to explore a **redesigned project view** with focus on what the repo is about, community info, package downloads where available, related projects and the ability to compare repos easily.

Here's what else you can use this for:

[Find other people in the Flask comunity](https://market.dev/ecosystems/flask/experts), and filter by location
Find Flask projects looking for contributors

There's a lot still to do - search and comparisons are two things we're focused on right now. But I would love some feedback from this sub to see how useful this is to you, and any features you'd like to see!

Thanks so much in advance for any feedback!

/r/flask
https://redd.it/1i27xs4
Any well known open-source python packages use Astral's uv tool?

I'm looking a Astral's uv, and it seems very interesting to manage applications and their dependencies. Even for internal packages I can see its use, but I'm having a hard time seen the workflow for an open-source public package where you need to support multiple Python versions and test with them.

Do you know of any open-source package project that uses uv in its workflow?

/r/Python
https://redd.it/1i20lvm
How do I run a standlone function in Django?

I have this function in a module. (not in views). Which processes some data periodically and saves the results. But Celery is giving me issues running it and I don't know if the function actually works as intended or not. So I want to run that function only for testing. How do I do this?

/r/djangolearning
https://redd.it/1i2ka0x