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
Unable to resolve 404 Not Found Error

I have a functioning HTML page with the following 'Accept' anchor button inside a table.

<td><a href="{{ url_for('accept_req', ad_id = ele[0].ad_id) }}" class="btn btn-outline-success">Accept</a></td>

Now I know for sure that ele[0].ad_id isnt causing the problem. Because the link is being generated.

But somehow the control is not reaching to the function definition:

@app.route('/edittable/acceptreq/<int:adid>', methods = 'GET', 'POST')
def acceptreq(adid):
#--------func definitions----
     
return
(rendertemplate("successpage.html"))



I am convinced that there is no similar named function or similar address (tried changing the route address but same result) function in my file.
-------------------------------------------------

Please guide me where am i going wrong?



/r/flask
https://redd.it/1em8c6b
Crawling Pages with Infinite Scroll using Scrapy and Playwright

Starting to document parts of my recent crawling journey in some blog posts. The first was navigating infinite scroll pages with inconsistent behaviors.

Crawling Pages with Infinite Scroll using Scrapy and Playwright





/r/Python
https://redd.it/1eo2yry
How to convert ipynb to pdf inside Jupyter notebook? I came across a solution stating we need to install pandoc but the official pandoc redirects us to the GitHub files which one to download now ??




/r/IPython
https://redd.it/1eo5ipp
LLM Aided OCR (Correcting Tesseract OCR Errors with LLMs with Python)

Code: https://github.com/Dicklesworthstone/llm\_aided\_ocr

# What My Project Does

Almost exactly 1 year ago, I made a little project using Llama2 (which had just come out) to improve the output of Tesseract OCR by correcting obvious OCR errors. That was exciting at the time because OpenAI's API calls were still quite expensive for GPT4, and the cost of running it on a book-length PDF would just be prohibitive. In contrast, you could run Llama2 locally on a machine with just a CPU, and it would be extremely slow, but "free" if you had a spare machine lying around.

Well, it's amazing how things have changed since then. Not only have models gotten a lot better, but the latest "low tier" offerings from OpenAI (GPT4o-mini) and Anthropic (Claude3-Haiku) are incredibly cheap and incredibly fast. So cheap and fast, in fact, that you can now break the document up into little chunks and submit them to the API concurrently (where each chunk can go through a multi-stage process, in which the output of the first stage is passed into another prompt for the next stage) and assemble it all in a shockingly short amount of time, and for basically a rounding error in terms of cost.

My original

/r/Python
https://redd.it/1eo6dxz
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/1eof43a
How to go from intermediate to advanced in Django & HTMX? Seeking Guidance on Django & HTMX Best Practices

Dear Django Community,

Like many of you, I've fully embraced the HTMX hype and have been developing an application as part of my job (1-2 days per week) for the past two years. Working solo, I've made stellar progress and implemented an astonishing amount of features given my limited time. However, now that the codebase is growing, I'm running into challenges with architectural decisions and could really use some expert advice on how to improve further. Here are a few of the issues I've been struggling with lately:

1. Front-end Code Organization:

I have numerous partials that get swapped in and out, and it’s becoming increasingly difficult to manage. My code is not very DRY; I find myself repeatedly implementing similar HTML swaps across the codebase. However, I’m also uncertain about reusing the same HTML code block in multiple locations. I’m unsure how to test such html blocks for proper swap-ins, and tracking dependencies reliably seems daunting. How do experts organize their front-end codebases to avoid such issues?

2. Dynamic Forms:

Initially, I implemented everything in pure HTML with HTMX, but the number of endpoints and swaps quickly spiraled out of control. Now, I use crispy_forms and submit the form on each change and then

/r/django
https://redd.it/1eoahao
Fits2db -Tool to load fits file tables into a sql database



What My Project Does:
fits2db is an open-source tool designed to convert FITS files (commonly used in astronomy) into SQL databases. This makes it easier to handle, query, and analyze the large datasets typically stored in FITS files.

Target Audience:
This tool is perfect for astronomers, data scientists, and anyone who regularly works with FITS files and needs an efficient way to manage and query their data.

Comparison:
Compared to existing tools, fits2db focuses specifically on seamless conversion to SQL databases, allowing for more flexible and powerful data manipulation than basic FITS file readers or converters that may not support complex queries.

I’m looking for feedback, feature suggestions, and potential contributors. Please check it out and share your thoughts!

GitHub: fits2db



/r/Python
https://redd.it/1eoa7ir
Flake8 Import Guard: Automate Import Restriction Checks in Python Projects

# What My Project Does?

Flake8 Import Guard is a Flake8 plugin that automates the enforcement of import restrictions in Python projects. It detects forbidden imports in new and modified files, focusing on newly added imports in Git-versioned files.

The plugin is highly configurable through `.flake8` or `pyproject.toml` files, allowing teams to tailor import restrictions to their specific needs.

# Target Audience

* Python developers working on medium to large-scale projects
* Development teams looking to enforce coding standards
* Open-source maintainers wanting to control library usage
* Anyone looking to gradually phase out deprecated modules or prevent the use of certain libraries
* Teams aiming to streamline their code review process

# Comparison

While there are several Flake8 plugins that handle various aspects of import checking(While plugins like `flake8-forbidden-imports`, or `flake8-tidy-imports` offer some similar functionalities), Flake8 Import Guard offers a unique combination of features not found in other plugins:

* Git-aware checking
* Unlike other plugins, it only flags newly added imports by considering Git change history. This makes it ideal for introducing to existing projects without causing immediate disruption.
* Flexible configuration
* Offers easy setup through `.flake8` or `pyproject.toml` files, allowing teams to tailor import restrictions to their specific needs. Seamless integration with existing Flake8

/r/Python
https://redd.it/1eoip79
A Slick n Lightweight screen recorder for linux! With some cool features :]


What My Project Does:

Slick Recorder is a lightweight and stylish recording application designed specifically for Linux. It offers a sleek user interface and powerful features to make your recording experience seamless and enjoyable.

Target Audience :

Linux Users

Comparison :

Noise Reduction: Automatically reduces background noise for clear audio recordings.
Easy to install just run 'pip install SlickRecorder'
Keyboard Input Display: Show your keyboard inputs in the recordings.
Subtitle Generation: Generate subtitles for your recordings effortlessly.
Lightweight GUI: A cool and minimalistic graphical interface to manage all your recording tasks.
Custom Cursors: Personalize your recording experience with custom cursor options.

Github : https://github.com/merwin-asm/SlickRecorder

/r/Python
https://redd.it/1eoptj5
Website to app

I have a functional website with frontend react and backend django. Now, i want to make a mobile application for the same+ i am a beginner. I want to know how can i create a mobile app using the same django backend. Should i use flutter or react native.

Please give any advice u have

/r/django
https://redd.it/1eoo6nv
I THINK I NEED HELP

In my internship they asked me for a few things

1. Deployment of Djano
2. SSL (HTTPS MODE) the issue is the company said they wanna see me deploy it on their local host for once (no cloud) and they want their intranet pcs to be able to use it

The issue is I dont quite get the deployment part
secondly their server is windows 2008 server

LIKE HOW CAN I DO IT NOW

I saw some youtube tutorials about nginx and waitress but idk
SO I AM HERE FOR HELP

/r/djangolearning
https://redd.it/1eov6a6
How handle files such as images

Guys I’m an unable to save files such as images in the database using flaskform. I choose an image and I submit I keep on seeing no selected image, I have tried using secure_filename() it also didn’t work. How do you guys solve this problem

/r/flask
https://redd.it/1eogfej
Best book to learn Django?

i am almost done with Corey's course and will be building projects so i want a book for Django

so recommend me one



/r/django
https://redd.it/1eorgd5
Hosting Options for React+Django

Hi

Are there any hosting providers that provide a react+django hosting plan? I tried https://choreo.dev/ but it does not seem that mature.

Thanks!

/r/django
https://redd.it/1eowd1y
Sharing what I would consider as a win

I consider myself as a baby in programming even though I have a CE degree.

I had received a notification on my Google account that its storage had reached 75%.
I could always pay a very small fee just for 100GB, but that's just a temporary fix - morphine for the pain.

So I needed to clean up my gmail manually - but not that manually.
I started googling and reading other people's codes who had already developed their own application for the same objective.


I don't know if this is considered stealing or cheating, but I took some for their code, tweaked it and mentioned their links in the [main.py](http://main.py/) file.

# Comparison

Here are their links (for comparison):
[https://github.com/marin117/Gmail-deleter/blob/master/src/gmail\_deleter.py](https://github.com/marin117/Gmail-deleter/blob/master/src/gmail_deleter.py)

[https://thepythoncode.com/article/use-gmail-api-in-python#google\_vignette](https://thepythoncode.com/article/use-gmail-api-in-python#google_vignette)

This is nothing more than a *personal project* - an idea that came to mind instead of temporarily fixing it with 100GB of additional storage.

# What My Project Does

Basically, it uses gmail's API to:

* **send messages** (did it to test the API).
* **get message-ids**.
* **delete messages**.

# Target Audience

Here is the link of the project for the curious minds:
[https://github.com/benSharon/Gmail-Manager](https://github.com/benSharon/Gmail-Manager)

Obviously, this project is for personal use.
I have used it to clean up my gmail's storage and, to be able to

/r/Python
https://redd.it/1eouavj
Can anyone suggest me a yt playlist

Hey can anyone please recommend me to a good YouTube playlist to learn Django which is not to difficult to learn but teachs all the concepts.

Thank in advance ☺️

/r/djangolearning
https://redd.it/1eo0vg7
Sunday Daily Thread: What's everyone working on this week?

# Weekly Thread: What's Everyone Working On This Week? 🛠️

Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!

## How it Works:

1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.

## Guidelines:

Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.

## Example Shares:

1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!

Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟

/r/Python
https://redd.it/1ep73kv
I'm building a Django Boilerplate Code Platform to save a lot of time when developing Django projects.

If you have some time (2 minutes) I'm trying to gather suggestions from the Django Developer community to build a software that generates you a Django Project with a lot of stuff pre-configured, saving you a lot of hours of boring and repetitive code and configurations.

I would love if you could spend 2 minutes filling this form or just leave some suggestions for the platform down here on the comments:
https://forms.gle/ZG99oqZsEWohmzK88

Thank you all!

/r/django
https://redd.it/1ep5sts
Display Ad implementation

I’m currently building an Ad feature for my companies website and building all the models from scratch with html and styles as well. I’m wondering if there are some other open source repos that have good setups for what I want. I’m only looking for display ads so nothing complicated like videos or anything.

Any help is appreciated.

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