pythondaily | Образование

Telegram-канал pythondaily - Python Daily

1102

Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels

Подписаться на канал

Python Daily

Any suggestions to my plan to learn Django?

For a bit of background, I'm a software engineer with 2+ professional YoE exclusively in Python for small scale applications, with some basic experience in FastAPI, MongoDB, PostgreSQL, PyQt and Docker. I would say I'm fairly proficient in core python but virtually no knowledge/experience in the fundamentals of the internet/HTTP/DNS/networking/cloud deployment, etc.

I'm really interested in learning Django which stems from my goal to build a web app that I have in mind + land a Django role in the distant future, whilst also hoping that the aforementioned weak areas will be learnt along the way.

As I'm in no real rush to learn Django and build my idea, I'd like to plan out some reading material hoping to comprehensively cover the main areas, including deployment, payment handling, etc. So, I'm not really interested in the 5-hour speedrun courses on youtube.

I also don't like the idea of jumping head first into building my idea, as I've taken that approach before and it resulted in a lot of undue stress from incessant jumping around which could've been avoided if I learnt things in a intuitively structured way. Also, I do plan on using the django docs for

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

Читать полностью…

Python Daily

Effective Python Developer Tooling in December 2024


I wrote a post of developer tooling I like at the moment: https://pydevtools.com/blog/effective-python-developer-tooling-in-december-2024/

/r/Python
https://redd.it/1hjcng4

Читать полностью…

Python Daily

Djangoroad YouTube channel gone? I've tried to look for the WSGI video for a refresher, but it seems like her channel is gone. :(

djangoroad">djangoroad" rel="nofollow">https://www.youtube.com/@djangoroad This was her YouTube channel, and her videos really helped me in deploying a containerized Django app for a client (No, seriously, I would've been fk if I didn't watch her video.)

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

Читать полностью…

Python Daily

Gunicorn vs Gunicorn with Uvicorn workers

Hi everyone,

I have a fully synchronous Django app running on Gunicorn with Uvicorn workers. However, I’ve run into a problem: I want to use Gunicorn’s instrumentation features and server hooks (pre_request, and post_request), but these aren’t supported with Uvicorn workers.

I’m debating whether to switch from Uvicorn workers to Gunicorn’s default synchronous workers. I’ve read that Uvicorn workers can still offer better performance, even for synchronous apps, so I’m not sure if I should switch or not.

Should I consider alternatives for instrumentation and server hooks, or would it be better to migrate to normal Gunicorn workers? I’d appreciate any advice or recommendations.

Thanks in advance!

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

Читать полностью…

Python Daily

Entry Level Django Developer

Hello everyone. I hope the community can help me. I have been practicing Python for a year and build web application projects using Flask and Django so I'm looking for an entry level Django job to improve my skills further, being mentored and gain experience in a company setting. I'm willing to be paid less and no benefits as long as I get the job and gain Django experience.

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

Читать полностью…

Python Daily

ShortMoji: Emoji Shortcuts Made Easy for Your Keyboard! 🧑‍💻✨

# What My Project Does

ShortMoji is a lightweight, open-source program that lets you insert emojis anywhere using simple, intuitive keyboard shortcuts. Inspired by Discord's emoji system, it supports **89 unique emoji shortcuts** (and counting!) to make your conversations and workflows more expressive.

Simply type a shortcut like `:smi`, and it transforms into 😃 instantly. ShortMoji runs in the background and is designed for speed and ease of use.

**Features include:**

* Fast emoji insertion via shortcuts.
* Low resource consumption.
* Quick program termination by pressing `Esc` twice.
* Free and fully customizable under the MIT license.

# Target Audience

ShortMoji is for anyone who loves emojis and wants a faster way to use them. Whether you're:

* A developer looking for efficiency.
* A casual user who enjoys using emojis.
* A Discord enthusiast already familiar with emoji shortcuts.

# Comparison

While there are other emoji tools available, ShortMoji sets itself apart with:

* **Customizable shortcuts:** Familiar to Discord users and adaptable for others.
* **Open-source freedom:** Unlike proprietary software, you can modify and expand ShortMoji as you like.
* **Minimal resource impact:** A lightweight utility that doesn’t slow down your system.
* **Simple UX:** No need to navigate menus or GUIs—just type and see the magic !

Unlike system-level emoji menus or bloated applications, ShortMoji is

/r/Python
https://redd.it/1hiuasv

Читать полностью…

Python Daily

Where to deploy a flask application ?

Hello,

I have a flask app + a script than runs with a crontab to populate data into a database.

I was wondering, is it better to deploy the app on a linux cloud server ? Or should I use a web hosting plateforms that supports flask out of the box ?





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

Читать полностью…

Python Daily

I need some websites with their sourcecode

Hi ! I teach web development using python (flask)
And i need some websites online that are built using flask for my students to learn by example.
Problem is i cant find a website like that with its source code available to public at a github repo.
I'll be happy if you could provide some examples down below ⬇️

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

Читать полностью…

Python Daily

Looking for a Django Collaborator(s). Why not building something together??

Hi all!

This is my first time posting here, so if this kind of request isn’t the norm, please be kind.

I’m a second-year CS student (female) learning Django on my own alongside a course I’ve already finished. I’m currently working on a project with deadline approaching (27th December, yikes!). The project has real-world potential, and if it’s good enough, I’ll get to present it to an employee or even secure school funding to develop it further.

I’d love to work on this project together with someone who’s interested in Django. If it turns into something bigger, we can both benefit from it— adding it to our portfolios and showcasing it as a real-world project.

If you’re interested in collaborating and also if u want to connect as coding buddies (Learning alone sometimes gets so lonely) dm me!

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

Читать полностью…

Python Daily

Look for some suggestions

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

Читать полностью…

Python Daily

D I don't see a point in rebuttals anymore.

This is a mixture of some contemplation and some rant but per the title, I just don't see a point in it. I recently got back results from a conference where I had two positive reviews and one negative. Then wrote a really nice rebuttal that addressed a fundamental misunderstanding of the reviewer (who, later, did increase their points so I guess the rebuttal was on mark?). But turns out, the meta-reviewer latched on to the negative review, didn't even read the rebuttal that addressed said review and rejected the paper.

What was even the point of me rebutting if concerned parties are _not even going to read them_? At this point, I am tempted to treat the rebuttal phase as an exercise in futility. Maybe I should withdraw papers in the first phase come any problems instead of trying to go through the agony of an ultimately meaningless labor.

/r/MachineLearning
https://redd.it/1hi9jt2

Читать полностью…

Python Daily

how to authenticate google oauth0 with flask

hello gurus i am new bie to flask and vue js how i make my login persistent and i have approach of sending data from frontend request body to backendband backend pull data from db and how to tell front end that i am authenticated and how sgould i persistently login

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

Читать полностью…

Python Daily

Pytask Queue - Simple Job/Task Management

# What My Project Does
This is my first ever public python package, it is a job/task management queuing system using sqlite.

Using a worker, jobs are picked up off the queue, manipulated/edited, then reinserted.

It is meant to replace messaging services like RabbitMQ or Kafka, for smaller, lightweight apps. Could also be good for a benchmark tool, to run several processes and use the sqlite database to build reports on how long n number of processes took to run.

# Target Audience
Devs looking to not have to use a heavier messaging service, and not having to write your own database queries with sqlite to replace that.

# Comparison
I don't know of any packages that do queuing/messaging like this, so not sure.

Feel free to give it a try and leave it a star if you like it, also feel free to submit a PR if you are having issues.

https://github.com/jaypyles/pytask

/r/Python
https://redd.it/1hi52fe

Читать полностью…

Python Daily

D chat-gpt jailbreak to extract system prompt

### Instructions

https://github.com/AgarwalPragy/chatgpt-jailbreak

### Original author
https://www.reddit.com/r/LocalLLaMA/comments/1hhyvjc/iextractedmicrosoftcopilotssystem/

### Extracted System prompt

You are ChatGPT, a large language model trained by OpenAI.
You are chatting with the user via the ChatGPT Android app. This means most of the time your lines should be a sentence or two, unless the user's request requires reasoning or long-form outputs. Never use emojis, unless explicitly asked to.
Knowledge cutoff: 2023-10
Current date: 2024-12-20

Image input capabilities: Enabled
Personality: v2

# Tools

## bio

The bio tool is disabled. Do not send any messages to it.If the user explicitly asks you to remember something, politely ask them to go to Settings - > Personalization - > Memory to enable memory.

## dalle

// Whenever a description of an image is given, create a prompt that dalle can use to generate the image and abide to the following policy:


/r/MachineLearning
https://redd.it/1hi429q

Читать полностью…

Python Daily

🌟 NanoDjango Enthusiasts, Assemble! 🚀✨

Hi everyone! 👋

I'm working on a small project using [NanoDjango](https://github.com/kracekumar/nanodjango), a lightweight Django-like framework, to build a **Provident Fund Tracker App**. I've got the app mostly set up, but I’m running into some challenges and would love some guidance from anyone who has experience with NanoDjango or Django in general.

# What I’ve Done So Far:

1. **Models:** I’ve defined `Company`, `Employee`, and `PFPayment` models for storing company and employee data.
2. **Data Fetching:** I implemented a custom management command to fetch data from an Excel file and an XML file and populate the database.
3. **Web Views:** I’ve created views for:
* A homepage listing all companies.
* A detailed view for each company, showing its employees.
* A detailed view for each employee, showing their payment history.
4. **Templates:** HTML templates are located in the `templates` folder and are working fine with the `render` function.

**Update: I can easily populate using admin panel but want to do with custom command which will take data from excel file.**

# The Problem:

I’m struggling with:

1. Running my custom management command to populate the database. What’s the correct command to use with NanoDjango ?.

I will share the repo if anyone intested in helping

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

Читать полностью…

Python Daily

[Release 0.4.0] TSignal: A Flexible Python Signal/Slot System for Async and Threaded Python—Now with

Hey everyone!

I’m thrilled to announce TSignal 0.4.0, a pure-Python signal/slot library that helps you build event-driven applications with ease. TSignal integrates smoothly with async/await, handles thread safety for you, and doesn’t force you to install heavy frameworks.

# What’s New in 0.4.0
## Weak Reference Support
You can now connect a slot with weak=True. If the receiver object is garbage-collected, TSignal automatically removes the connection, preventing memory leaks or stale slots in long-lived applications:

```python
# Set weak=True for individual connections
sender.event.connect(receiver, receiver.on_event, weak=True)

# Or, set weak_default=True at class level (default is True)
@t_with_signals(weak_default=True)
class WeakRefSender:
@t_signal
def event(self):
pass

# Now all connections from this sender will use weak references by default
# No need to specify weak=True for each connect call
sender = WeakRefSender()
sender.event.connect(receiver, receiver.on_event) # Uses weak reference

# Once `receiver` is GC’d, TSignal cleans up automatically.
```

## One-Shot Connections (Optional)
A new connection parameter, one_shot=True, lets you disconnect a slot right after its first call. It’s handy for “listen-once” or “single handshake” scenarios. Just set:

```python
signal.connect(receiver, receiver.handler, one_shot=True)
```

The slot automatically goes away after the first emit.

## Thread-Safety Improvements
TSignal’s internal locking and scheduling mechanisms have been refined to further reduce race conditions in high-concurrency environments. This ensures more

/r/Python
https://redd.it/1hj9cjs

Читать полностью…

Python Daily

(noob q) What's the best way to set up a many-to-many relationship with djangorestframework?

To simplify the scenario:

My app has users and pre-defined cards. Users can build decks using the cards that are available.

So of course I need models for User, Deck, and Card.

Each User:Deck is 1:many - easy, add foreign key to Deck for User/owner

Here's where I'm not sure what the best option is:
Each Deck includes many cards, and each card may belong to many decks.
Should I build a list of cards that belong to the deck, then include them as a single field? (I think this would be slower because I'd have to retrieve the list then query for those cards?)
Or should I build a separate table that has a separate row for each deck-card relation? (So I would take Deck ID, filter DeckCards by deck ID, and all the cards listed are available)

I'm learning about serializers and hyperlinking right now, but not sure what would be the best way to set up my API here. I followed through the DRF tutorial and it looks like they used hyperlinking for 1:many (users:snippets) but not sure if I can do it the same way for many:many.

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

Читать полностью…

Python Daily

D Struggling to Find My Path in PhD Research

Hi everyone, I hope you don’t mind me venting a bit, but I’m hoping to gain some insight into a challenge I’ve been facing. I’m a second-year PhD student researching time series, and honestly, I thought by now I would have a clear research question. But I don’t, and it’s starting to get to me.

Part of the struggle comes from the overwhelming pressure to pick a “hot” topic. A lot of the research I see in the field feels driven by what I can only describe as Shiny Object Syndrome—chasing the latest trends rather than focusing on work that’s meaningful and substantial. For example, I’ve seen several papers using large language models (LLMs) for time series forecasting. While LLMs are undeniably fascinating, it feels more like an attempt to forcefully fit them into time series because it’s “cool,” not because it’s the best tool for the problem at hand. And I don’t want to be part of that trend.

But here’s the dilemma: How do you choose a research topic that feels both authentic and impactful, especially when everything around you seems so driven by the latest hype? Do you follow these emerging trends, or do you focus on something that

/r/MachineLearning
https://redd.it/1hj6nbf

Читать полностью…

Python Daily

How I got a data analytics job of 10LPA | Fresher data analyst interview experience 2024 | Python

Hello guys I am Dharshan, a final year computer science student. In this video, I have share my detailed interview experience with Tredence, where I secured a Data Analyst job offer for 10 LPA! for which I used python to crack the coding questions. I'll be joining in 2025, and I’m excited to walk you through my journey. I have already posted 3 interview experience videos on my channel and the next one will be amazon interview experience. https://youtu.be/aeLL29SHBGw?si=9CULGR5plBDWs-jg

/r/Python
https://redd.it/1hj4ir0

Читать полностью…

Python Daily

How to make a main consumer that dispatches requests to multiple sub-consumers

I need to accomplish three real-time tasks using Django Channels. I need to track the status of my users (if they are online or offline), I need to send them notifications while they're on the site and I need to manage a live chat. I could maintain three separate WebSocket connections to three different consumers but that would be a pretty inefficient use of ressources.

I would prefer to have one main WebSocket connection with a single consumer that dispatches the requests made to it to three sub-consumers to make it nice, clean and efficient while maintaining a clear separation between the three tasks.

How do I do this?

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

Читать полностью…

Python Daily

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/1hixdkr

Читать полностью…

Python Daily

bnap4000 - A simple music player made in made with true randomness in mind.

I have been working on a terminal music player for Linux and Windows. Feel free to suggest or report bugs on GitHub.

What does my project do: It's meant to be a simple, lightweight music player that runs right in your terminal. It's main purpose is to play music randomly and stay out of your way, you just drop music into your music folder and let it play.

Target Audience: Mostly meant for slightly tech savvy people who want something that won't take up a ton of resources, it only uses \~60mb of RAM on my system.

Comparison: I'd compare it to VLC Media player, what I think bnap4000 does better is with simplicity. It has a very simple UI that shows what song is playing, a couple things like volume, a progress bar, and a queue.

GitHub page: https://github.com/0hStormy/bnap4000
bnap stands for Badass New Audio Player if you were wondering.

/r/Python
https://redd.it/1hiqw7l

Читать полностью…

Python Daily

Built my own link customization tool because paying $25/month wasn't my jam

Hey folks! I built shrlnk.icu, a free tool that lets you create and customize short links.

What My Project Does: You can tweak pretty much everything - from the actual short link to all the OG tags (image, title, description). Plus, you get to see live previews of how your link will look on WhatsApp, Facebook, and LinkedIn. Type customization is coming soon too!

Target Audience: This is mainly for developers and creators who need a simple link customization tool for personal projects or small-scale use. While it's running on SQLite (not the best for production), it's perfect for side projects or if you just want to try out link customization without breaking the bank.

Comparison: Most link customization services out there either charge around $25/month or miss key features. shrlnk.icu gives you the essential customization options for free. While it might not have all the bells and whistles of paid services (like analytics or team collaboration), it nails the basics of link and preview customization without any cost.

Tech Stack:

Flask + SQLite DB (keeping it simple!)
Gunicorn & Nginx for serving
Running on a free EC2 instance
Domain from Namecheap ($2 - not too shabby)

Want to try it out? Check it

/r/Python
https://redd.it/1hij1l8

Читать полностью…

Python Daily

Can someone explain what sessions are, and why am I facing so much of a problem with my API permissions?

The problem I am facing is that I am not able to access my newly built APIs that require the [IsAuthenticated\] permissions to fetch the data in my Svelte frontend, whereas I am able to perform all the [IsAuthenticated\] API functions on the django restframework UI while testing my APIs. For example, whenever I login using my DRF UI, this is the output I get:
User: Turf Nation

Turf ID: 1, Date: 2024-12-18

[20/Dec/2024 16:46:42] "GET /enterprise/slot-status/?turf_id=1&date=2024-12-18 HTTP/1.1" 200 16716

and now whenever I do the same process using the Svelte frontend, I get this:

User: AnonymousUser

Turf ID: 1, Date: 2024-12-19

[20/Dec/2024 16:47:34] "GET /enterprise/slot-status/?turf_id=1&date=2024-12-19 HTTP/1.1" 200 4460

As you can see the user is being recognised using the DRF UI while not for the frontend. I asked chatGPT about this, and it said this is all related to sessions and cookies, and ISTG, I have never really used those before. The frontend logic is not wrong either because I can access the GET POST functions when they are [AllowAny\].

Can anyone help with this?

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

Читать полностью…

Python Daily

Display logs generated by class in flask page in real time

I want to display python logs generated when a class is getting executed by taking input from page.i want to display the logs generated as the class is executing in real time in flask page.but the class is getting executed only then the next page with logs is displayed.
Any idea how can I display logs in flask page as the class is executing ..

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

Читать полностью…

Python Daily

Python in Finance/Controlling

Hi everyone! I've been working in the controlling department of my company for about 3 months. Generally, apart from SAP, I'm terrified by the amount of Excel, the amount of files that I prepare for analyses for other departments. Of course, every excel has queries from SQL... I'm thinking about switching to Python, but I'm afraid that people won't understand it. I used to work on production analyses, I did a lot of "live" Power BI reports and in Python for my calculations. My goal is to replace Excel with Python.

/r/Python
https://redd.it/1hi0jhp

Читать полностью…

Python Daily

Master the Fundamentals of Python - Free Course - Videos, text, projects, exercises and solutions

Master the Fundamentals of Python is a comprehensive course that I was recently selling for $99 but have now released for free.

[View the playlist here.](https://www.youtube.com/playlist?list=PLVyhfExBT1XC-5ls9DezJIqioVYhf-09t)

[Download the material here.](https://drive.google.com/drive/folders/1PcVbvPENdbMG1Bdax90kOl0GuT1EX9HZ?usp=drive_link)

The course comes with:

* 300 page PDF
* 20 modules
* Videos
* Projects
* Hundreds of exercises with solutions

This is a college-level course that requires over 50 hours of effort to complete.

Modules

1. Operators
2. What is Python
3. Objects and Types
4. Strings
5. Lists
6. Ranges and Constructors
7. Conditional Statements
8. Writing Entire Programs
9. Looping
10. List Comprehensions
11. Built-in Functions
12. User-defined Functions
13. Tic-Tac-Toe
14. Tuples, Sets, Dictionaries
15. Python Modules
16. User-defined Python Modules
17. Errors and Exceptions
18. Files
19. Classes
20. Texas Hold'em Poker

/r/Python
https://redd.it/1hhvja2

Читать полностью…

Python Daily

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/1hi6vlj

Читать полностью…

Python Daily

Ultimate Guide for Creating a Production Django Container
https://bkiran.com/blog/setup-production-django-container

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

Читать полностью…

Python Daily

unable to access config from celery task

I am currently working on an app where i need to have scheduled tasks that perform som api calls to external service and store results in a db.

I use Celery to achieve this using this guide https://flask.palletsprojects.com/en/stable/patterns/celery/
, i am able to schedule my tasks but the config containing all the api endpoint details and stuff is empty.

here is my testing code if i instead pass currentapp.config in helloworld() the only config variable set is "rootpath"

### in app/tasks
from celery import shared
task
from flask import currentapp
from app import app, config

@sharedtask(ignoreresult=False)
def hello
world():
print(config.dict)




### in app/Config.py
CELERY = dict(
brokerurl="redis://",
result
backed="redis://",
taskignoreresult=True,


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

Читать полностью…
Подписаться на канал