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
Real-time glucose updates on Discord

I made a small python script to read your glucose level and update your discord 'playing status' accordingly. Also displays a quote based this value.

Here's a link to the Github. Make sure to give some feedback.

This script uses the API of the external LibreLinkUp app and sents some HTTP requests to retreive glucose data.
It also uses qwertyquerty's Pypresence to update Discord's 'Currently playing status' in which the glucose level and other data is shown.

​

Example of my blood sugar being a little high after a meal.

​

Another example. This time it is on a good value.

I am planning on running this on my raspberry pi at home so it will update constantly.

It was a very fun little project to work on!

By the way, if you got some fun quotes, make sure to post them in the comments and I might add them.

/r/Python
https://redd.it/xf0i8c
How to auto-grading a exam on a website?

Hi all,


I'm helping a friend to improving his website. He is running a educational website for school kids. On that site kids are required to do exams for certain subjects. He wants to to improve the website by having a automatic grading system so he can skip grading by hand. Do you have any idea how to do that? Or is this even a backend problem? Some creative solutions?


The exams consist multiple choices, fill in the blanks, and some questions you have to hand drawing the solutions. For example draw force diagram graph in physics. Which i think it's quite impossible.

/r/Python
https://redd.it/xffxqe
GeoDjango - Can someone explain the difference between PostgreSQL and PostGIS?

SOLVED!

Please see the current state of this problem at the link below to the new thread

https://old.reddit.com/r/django/comments/xftmkr/geodjangoround2setupcompletestrugglingto/?

-----

I have a form which accepts a five digit zip code.

This should return a list of all models with a zip code field within x miles radius of the submitted zip code.

I have been informed that this is possible with GeoDjango. I am following the GeoDjango tutorial here: https://docs.djangoproject.com/en/4.1/ref/contrib/gis/tutorial/

Now in the first steps, it appears that I'm all the sudden supposed to replace PostgreSQL under "Databases" in settings.py with PostGIS.

First off, I'm not excited about losing literally all of my data.

Second, can anyone explain briefly what the difference is between the two? The only reason I'm using PostgreSQL is because I've been specifically told that if you are deploying a Django website to production, PostgreSQL is indisputably the way to go every single time. Something about being able to handle a shitload of requests and be able to scale easily. I think Heroku also may or may not require it.

Anyways, am I actually supposed to kill PostgreSQL?

/r/django
https://redd.it/xfso52
[D] Machine Learning - WAYR (What Are You Reading) - Week 140

This is a place to share machine learning research papers, journals, and articles that you're reading this week. If it relates to what you're researching, by all means elaborate and give us your insight, otherwise it could just be an interesting paper you've read.

Please try to provide some insight from your understanding and please don't post things which are present in wiki.

Preferably you should link the arxiv page (not the PDF, you can easily access the PDF from the summary page but not the other way around) or any other pertinent links.

Previous weeks :

|1-10|11-20|21-30|31-40|41-50|51-60|61-70|71-80|81-90|91-100|101-110|111-120|121-130|131-140|
|----|-----|-----|-----|-----|-----|-----|-----|-----|------|-------|-------|-------|-------|
|[Week 1](https://www.reddit.com/4qyjiq)|[Week 11](https://www.reddit.com/57xw56)|[Week 21](https://www.reddit.com/60ildf)|[Week 31](https://www.reddit.com/6s0k1u)|[Week 41](https://www.reddit.com/7tn2ax)|[Week 51](https://reddit.com/9s9el5)|[Week 61](https://reddit.com/bfsx4z)|[Week 71](https://reddit.com/d7vno3)|[Week 81](https://reddit.com/f1f0iq)|[Week 91](https://reddit.com/hlt38o)|[Week 101](https://reddit.com/k81ywb)|[Week 111](https://reddit.com/myg8sm)|[Week 121](https://reddit.com/pmzx3g)|[Week 131](https://reddit.com/srsu2n)||||||||||||
|[Week 2](https://www.reddit.com/4s2xqm)|[Week 12](https://www.reddit.com/5acb1t)|[Week 22](https://www.reddit.com/64jwde)|[Week 32](https://www.reddit.com/72ab5y)|[Week 42](https://www.reddit.com/7wvjfk)|[Week 52](https://reddit.com/a4opot)|[Week 62](https://reddit.com/bl29ov)|[Week 72](https://reddit.com/de8h48)|[Week 82](https://reddit.com/f8fs6z)|[Week 92](https://reddit.com/hu6zq9)|[Week 102](https://reddit.com/kh27nx)|[Week 112](https://reddit.com/n8m6ds)|[Week 122](https://reddit.com/pw14z5)|[Week 132](https://reddit.com/t2xpfe)||
|[Week 3](https://www.reddit.com/4t7mqm)|[Week 13](https://www.reddit.com/5cwfb6)|[Week 23](https://www.reddit.com/674331)|[Week 33](https://www.reddit.com/75405d)|[Week 43](https://www.reddit.com/807ex4)|[Week 53](https://reddit.com/a8yaro)|[Week 63](https://reddit.com/bqlb3v)|[Week 73](https://reddit.com/dkox1s)|[Week 83](https://reddit.com/ffi41b)|[Week 93](https://reddit.com/iaz892)|[Week 103](https://reddit.com/kpsxtc)|[Week 113](https://reddit.com/njfsc6)|[Week 123](https://reddit.com/q5fi12)|[Week 133](https://reddit.com/tdf2gt)||
|[Week 4](https://www.reddit.com/4ub2kw)|[Week 14](https://www.reddit.com/5fc5mh)|[Week 24](https://www.reddit.com/68hhhb)|[Week 34](https://www.reddit.com/782js9)|[Week 44](https://reddit.com/8aluhs)|[Week 54](https://reddit.com/ad9ssz)|[Week 64](https://reddit.com/bw1jm7)|[Week 74](https://reddit.com/dr6nca)|[Week 84](https://reddit.com/fn62r1)|[Week 94](https://reddit.com/ijjcep)|[Week 104](https://reddit.com/kzevku)|[Week 114](https://reddit.com/ntu6lq)|[Week 124](https://reddit.com/qjxfu9)|[Week 134](https://reddit.com/tpruqj)||
|[Week 5](https://www.reddit.com/4xomf7)|[Week 15](https://www.reddit.com/5hy4ur)|[Week 25](https://www.reddit.com/69teiz)|[Week 35](https://www.reddit.com/7b0av0)|[Week 45](https://reddit.com/8tnnez)|[Week 55](https://reddit.com/ai29gi)|[Week 65](https://reddit.com/c7itkk)|[Week 75](https://reddit.com/dxshkg)|[Week 85](https://reddit.com/fvk7j6)|[Week 95](https://reddit.com/is5hj9)|[Week 105](https://reddit.com/l9lvgs)|[Week 115](https://reddit.com/o4dph1)|[Week 125](https://reddit.com/qtzbu1)|[Week 135](https://reddit.com/u0pnhf)||
|[Week 6](https://www.reddit.com/4zcyvk)|[Week 16](https://www.reddit.com/5kd6vd)|[Week 26](https://www.reddit.com/6d7nb1)|[Week 36](https://www.reddit.com/7e3fx6)|[Week 46](https://reddit.com/8x48oj)|[Week 56](https://reddit.com/ap8ctk)|[Week 66](https://reddit.com/cd7gko)|[Week 76](https://reddit.com/e4nmyk)|[Week 86](https://reddit.com/g4eavg)|[Week 96](https://reddit.com/j0xr24)|[Week 106](https://reddit.com/ljx92n)|[Week 116](https://reddit.com/odrudt)|[Week 126](https://reddit.com/r4e8he)|[Week 136](https://reddit.com/ub2xlz)||
|[Week
Tensorflow on JupyterHub unable to detect GPUs

Hello,

​

Thank you for all the content you provide. It plays a crucial factor in my ML education.

​

I am having problems setting up Tensorflow on JupyterHub to detect GPUs (currently, it only uses a CPU). The end goal and idea is to set up the multi-user JupyterHub interface where I can manage GPU resources that run on the Ubuntu server. Some schemes would look like this:

\-Admin

|- user1: 2 usable GPUs

|- user2: 3 usable GPUs

|- user3: 4 usable GPUs

|- user4: 1 usable GPU

​

Currently, I want to divide and conquer the Tensorflow able to detect and use the GPUs part. With the command "nvidia-smi" in JupyterHub Terminal, where I have installed all TF-related libraries along with Docker, I am able to see all GPUs ( NVIDIA-SMI 460.73.01 Driver Version: 460.73.01 CUDA Version: 11.2). Have you experienced the similar problem, and what will you advise me to do? Is it even possible to manage resources with the JupyterHub interface?

​

Thank you in advance for your time.

​

I am looking forward to hearing from you!

/r/IPython
https://redd.it/xfnj5j
If statement for href

Is there a method to create an if statement for an href . Like If the href button is pressed execute a command.

/r/djangolearning
https://redd.it/xgar6e
Advice for getting a Flask job?

Just graduated a bootcamp that went over html/css, JS, Python, Flask, and React. My best project is a Pokemon themed social media app made in Flask. It covers a lot of the big buzzwords

https://pokemonsocial308.herokuapp.com/home

\-User authentication with password encryption

\-fetches JSON from a 2nd Flask database I set up

\-RESTful API routes for the blog posts

\-CRUD functionality for the users and their posts

\-Postgres database

​

I was SO happy with my progress at first. But I'm getting zero responses from job applications so maybe I still have a ways to go.

Lots of job listings mention Docker, Kubernetes, and Amazon Web Services. Maybe I should add those to my list of skills next?

/r/flask
https://redd.it/xgau2z
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/xg72un
Flask Website doesnt behave as i wish, and i dont know why?

Hello there,

I am pretty new to flask and Python an tried to make flask app wich doesnt really work as i wish. I dont get any errors its just not what i want.

So i have 3 Problems:

1. is the Web App has Checkboxes but if i submit one of them, every of them changes
2. why does the checkbox uncheck after reloading the website
3. My third Problem is that i want to get back the value form {{supervisor['number'\]}} if the checkbox is checked

​

<div class="number-items" name="service-number">{{supervisor'number' }}</div>

&#x200B;

HTML:

{% for supervisor in supervisorusers %}
<div class="number-alignment">
<div class="number-container">
<div class="number-items">{{ supervisor'name' }}</div>
<div class="number-items" name="service-number">{{supervisor'number' }}</div>
<div class="number-items">


/r/flask
https://redd.it/xgj6lh
How can I add comments option in the same detailview(another function that shows the blog post)

&#x200B;

https://preview.redd.it/97zys9efrmo91.png?width=840&format=png&auto=webp&s=34b990f9223969f19f382bac6533e619c42409f4

&#x200B;

https://preview.redd.it/whoskiwirmo91.png?width=786&format=png&auto=webp&s=1dc5986ee8e68ff0ab9fb7286ed722112795cacd

im currently using seperate page for adding the comment

I need to click on 'add a comment' then it takes me to add_comment.html

here is the function



class AddCommentView(CreateView): #book
model = Comment
# fields = "__all__"
# fields = ['title','author','genre','content']
form_class = CommentForm
template_name = 'app/add_comment.html'
def form_valid(self, form):
list_obj = List.objects.get(slug = self.kwargs['slug'])
        form.instance.list = list_obj
return super().form_valid(form)
success_url = reverse_lazy("app:list")

is there any way I can do that inside my list_detail.html file?

&#x200B;

&#x200B;

another question

How can I redirect the browser to the same list_detail page? the problem is it contains slug link. and i dont know how to mention that in reverse lazy.

/r/django
https://redd.it/xhirb7
Data doesn't get saved in the database with post request

Hello everyone! I started learning Django a week ago and i decided to create a poll app where users can login, signup, create their own polls and vote on them. Everything is working fine except for the poll creation part (it was also working and i honestly can't remember if i changed something in one of the views, forms or templates because the last time i worked on it it was a couple of days ago... this is also the only time i didn't initialize a repo, sigh).

Basically the problem is that when i write the text in the form and press the "create poll" button i get redirected to the "home", which is what i want, and in the terminal i can see that a post request was made but the data doesn't get saved in the database. I don't get any error, warning or message of any kind. Here is the code:

views.py

@login_required
def create(request):
if request.method == 'POST':
question_form = QuestionForm(request.POST)
choice_form

/r/djangolearning
https://redd.it/xhh8bx
How do you like to "plan out" your Django apps?

Does anyone use any visual tools for something like this? a text document with nesting?

I've got a project I'm pretty excited about, but I will probably wanna think about/work on it from my tablet, while not entirely in the code-base.

I think I may setup VSCode server so I can work from my laptop/tablet too, but this is kind of a bit before that.

It's been ~2 years since I've used Django, and while I felt decently competent with it, I wanna try and plan my project out better than previously.

Cheers!

/r/django
https://redd.it/xhw8b0
Where to host Flask projects for clients?

Hi

I am looking at doing some web development freelance work and want to use flask as the backend as this is the framework i've learned and am comfortable with. This might change in future as I upskill my JS framework knowledge.

However, for now I wanted to know for now where is the best place to host these websites if i'm doing it for clients. I want somewhere I can set it up and know that there are not going to be any issues that cause problems with the clients website down the line.

Love to know peoples experience with this and any recommendations.

Thanks

/r/flask
https://redd.it/xhudv0