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
This media is not supported in your browser
VIEW IN TELEGRAM
2D Raycasting along with Rendered view - Visualization was done using Pygame! People who love games would definitely love this! Link to the Github repository in the comments!

/r/Python
https://redd.it/grwueh
Fast QR-ticket scanning

Not sure if this is the right place to ask, as i suspect the solution maybe isn't directly related to Django, however maybe someone has had a similar situation.


I have developed a very simple ticket system with QR-codes on a django website. It works by simply creating QR-codes which contains the link to register the attendance of that particular ticket, which must be done with an admin account.
A link looks like: mysite.com/qr-ticket/register/<event\_id>/<ticket\_id>.


This works rather well, with the exception of the registry process being a little slower than desired. Each time a QR-code is scanned, the person scanning has to open the link and visit the website in order to register attendance. What I ideally would want is that when the QR-code is scanned (by a phone), a post request is sent to the server, which returns a response of success/fail or something similar, i.e. not needing to visit the website in order to register attendance. Does anyone know of a clever way to achieve this, without developing a custom app?

/r/django
https://redd.it/grrc0y
Promises in the backend

I've been using Flask which doesn't have async built in. Lately I have been comparing Flask to other backend frameworks like ExpressJS which does have async built in as it is JavaScript based. My question is for a backend framework do you actually need async features that often? One of the only use case I can think of is if you wanted the backend to fetch some APIs. Are there any other times you would really need async in the backend as part of your web framework? Thanks.

/r/flask
https://redd.it/grzmlx
PyTorch fails on me when using local Jupyter to run epochs

/home/onur/.local/lib/python3.6/site-packages/torch/nn/functional.py:2854: UserWarning: The default behavior for interpolate/upsample with float scale_factor will change in 1.6.0 to align with other frameworks/libraries, and use scale_factor directly, instead of relying on the computed output size. If you wish to keep the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details.

Hi.

I am trying to run a classifier on my local notebook to use my own GPU instead of relying on Colab. When I try to run a single epoch to find the learning rate, I get many repeats of the above message.

I get that its just a warning but my epoch does not run at all.

/r/IPython
https://redd.it/grym25
How do you divide your website into apps

Hi! I’m very new to Django, planning to transfer from Node.js as it seems be more comvenient for me. I’ve just finished a small polls site from the official Django documentation, and am wondering particularly about the apps. How do you usually divide the functionalities of the apps? How do you determine how to divide them? For example, I’m planning to make a simple registration + login system to test out my fundamental Django knowledge, how many apps would you create for that?

Looking forward to your insights! Thanks in advance!

/r/django
https://redd.it/gs3aev
How to Handle Computationally Expensive Tasks under Load?

My site's core function takes about a second to run; I'm worried that if there's spikes in traffic, this might cause the site to be unresponsive.

Some common solutions seem to be calling it asynchronously or using message brokers. I'm not super experienced, so I can't really tell if I should use one of these.

What's the best way to handle CPU-bound expensive functions in Flask?

/r/flask
https://redd.it/gs5sjx
Is the action option in the form tag is necessary?

Hey, I'm building a project with Flask and python. I have signup route with signup form in it. I'm using werkzeug.security.generate\_password\_hash to encrypt the given password, but I'm doing it in the route function of the signup route (@app.route('/signup'...)).

I have 2 questions:

1. Is it fine? I want to encrypt the password on the client-side.
2. In the HTML file of the signup route, the form tag I'm specifying has no action=... attribute. so how does it knows where to send the data? and do I need to have the action attribute?

/r/flask
https://redd.it/gs98nf
A Python GUI for uninstalling the default Windows 10 apps.

/r/Python
https://redd.it/gs7xdb
Real Time Object Detection with yolov3 in tensorflow 2.2

Hello, I would like to share with you my implementation of yolov3 object detector in tensorflow 2.2

[yolov3-keras-tf2](https://github.com/emadboctorx/yolov3-keras-tf2)

&#x200B;

https://reddit.com/link/gs0olx/video/4m6zvqqb1g151/player

**Features**

* tensorflow-2.X--keras-functional-api
* cpu-gpu support
* Random weights and DarkNet weights support
* csv-xml annotation parsers.
* Anchor generator.
* \`matplotlib\` visualization of all stages.
* \`tf.data\` input pipeline.
* \`pandas\` & \`numpy\` data handling.
* \`imgaug\` augmentation pipeline
* \`logging\` coverage.
* All-in-1 custom trainer.
* Stop and resume training support.
* Fully vectorized mAP evaluation.
* \`labelpix\` support.
* Photo & video detection

&#x200B;

https://preview.redd.it/8albre2uff151.png?width=640&format=png&auto=webp&s=c0c8ff14ab13f6149b333d1a016ca0e66cecc975

https://preview.redd.it/nwklye2uff151.png?width=1712&format=png&auto=webp&s=c5ef0fe3bfb4650437bf75cc95b834025980f964

https://preview.redd.it/o9pvhf2uff151.png?width=900&format=png&auto=webp&s=7b4074a050121a7f507ef5c0c50d4d8e38479e3a

https://preview.redd.it/vvlwef2uff151.png?width=640&format=png&auto=webp&s=8abe3084e913fe16f01d34d014b0a4d095f9d701

/r/IPython
https://redd.it/gs0olx
Book Review: Speed Up Your Django Tests

Some weeks ago, I bought an eBook `Speed Up Your Django Tests` written by Adam Johnson. Who is a member of the Django project Technical Board.

The book talk about some `best-practices` about Django tests, it would help speed up your Django tests and find problem in less time.

I also wrote a short book review, if you want to know more about how to improve your Django tests, you can check this post.

[Book Review: Speed Up Your Django Tests](https://www.accordbox.com/blog/book-review-speed-your-django-tests/)

/r/django
https://redd.it/gs5k38
Best practice for for creating a user based token for 3rd party apps in Django?

I have an application that needs users to give access to a 3rd party application.

The requirements are that the 3rd party application has the same permissions as the user (acts on the user's behalf)

The 3rd party application has no frontend, so the oauth2 redirection flow doesn't quite work.

My initial thought was to create a model for 3rd-party applications and the User can add their own apps.

By adding an app, the user would receive a app ID (or client id) and a app Secret (or client secret). The user gives the 3rd party app this information and it can request a Bearer Token once (After that, this combination of ID and Secret won't work). That Bearer Token will live for X seconds, but the application can refresh the Token with a Refresh Token it will get back as well.

I realize this looks almost identical to Oauth2, but I haven't figured out how to achieve it with Django Oauth Toolkit at least.

Any recommendations?

Thanks!

/r/django
https://redd.it/gsef2g
This media is not supported in your browser
VIEW IN TELEGRAM
Working on a text-based "choose your adventure" story-telling game played in the terminal!

/r/Python
https://redd.it/gseyw9
Made an abstract art maker using random numbers in Python

/r/Python
https://redd.it/gsnndn
im a loner, so i wrote a program to write my diaries / express my feelings to my future self
https://www.youtube.com/watch?v=XUcAll7VcsY

/r/Python
https://redd.it/gsmz82