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
Bare essential javascript to learn to help with flask

I feel that recently lack of ability to interact with dom is getting in the way of me communicating between back and front-end. (ofc, I could be entirely wrong too)

i really want to focus on python and flask at this period but am ope to invest time to JS to help with that journey. I am building things for myself so do not need to achieve anything fancy.

In order for me to make the most of that time what subjects should I focus on? (I hear eloquent is a good book)

Thank you for helping/reading

/r/flask
https://redd.it/ihgum3
Thursday megathread: Python careers!

Discussion of using Python in a professional environment, getting jobs in Python and more!

**This thread is not for recruitment, please see** r/PythonJobs **or the thread in the sidebar for that.**

/r/Python
https://redd.it/ihaiio
Django admin: adding objects for foreignkey from other side

so I have these two models:

class Recipe(models.Model):
short_description = HTMLField(max_length=400)
likes = models.ManyToManyField(User, blank=True,
related_name='recipe_likes')
slug = models.SlugField(blank=True, unique=True)
published_date = models.DateTimeField(blank=True, default=datetime.now)
ratings = GenericRelation(Rating, related_query_name='recipes')

class Ingredient(models.Model):
name = models.CharField(max_length=20)
amount = models.FloatField()
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE,


/r/django
https://redd.it/ihij82
Are my tests okay?

I read on Two Scoops of Django that you should test the following aspects of your models:

>Two Scoops of Django 3.x
>
>Models: Creating/updating/deletingofmodels,modelmethods,modelmanagermethods.

however, there is not an example of how to do it with pytest, is my approach correct for these tests?

​

models.py

from model_utils.models import TimeStampedModel
import uuid

# from mysocialbeer.accounts.models import Account
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.urls import reverse


class Post(TimeStampedModel):
"""
This is the model that represent posts in MySocialBeer
"""

uid = models.UUIDField(default=uuid.uuid4())
title = models.CharField(verbose_name=_("Title"), max_length=50)
body = models.TextField(verbose_name=_("Body"))
latitude = models.FloatField(verbose_name=_("Latitude"))


/r/djangolearning
https://redd.it/ihskvi
Friday megathread: Free chat Friday!

Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!

/r/Python
https://redd.it/ihwl4s
Is there a better way to handle unexpected view errors.

What I do is, I add a middleware so that in case the view function raises an unhandled exception the default Django response is overridden by my specified response, see the following code snippet.


class ErrorHandlingMiddleware:
"""
The purpose of this middleware is to handle unexpected errors in the requests and
provide a user friendly error response.
"""

def __init__(self, get_response):
self.get_response = get_response

def __call__(self, request):
response = self.get_response(request)
return response

@staticmethod
def process_exception(request, exception):
if settings.DEBUG:


/r/django
https://redd.it/ihznwr
I learned how to make an online Multiplayer game using Python!!

I am interested in game development but am very new to it. I've messed around with unity and C# for a bit but decided I wanted to learn how to create an online multiplayer game like Agario or Draw my things. I decided to use Python since it is my favorite language!

The whole process was pretty difficult. I had to learn to make web apps (flask), web sockets (socketio), manage databases, and a bunch of other stuff.

[If you are interested in the process or want to see how it turned out, check out my video here!](https://www.youtube.com/watch?v=DrYXpVLQY_E)

Thanks

/r/Python
https://redd.it/ii1tnj
[R] Extended blog post on "Hopfield Networks is All You Need"

My colleague Johannes Brandstetter wrote an awesome blog post on our new paper "Hopfield Networks is All You Need": [https://ml-jku.github.io/hopfield-layers/](https://ml-jku.github.io/hopfield-layers/)

It illustratively introduces traditional, dense, and our modern Hopfield neworks, and provides explained code examples of the Hopfield layer.

Highly recommended!

/r/MachineLearning
https://redd.it/ii319z
PyWeek 30 starts on the 20th September!

***PyWeek 30 will begin on the 20th September (00:00 UTC) and end on the 27th September (00:00 UTC).***

# What is PyWeek?

PyWeek is one of the longest running events in the Python community – it's been run twice a year for the past 15 years! During the jam, competitors are given a theme which is decided by the community through a vote. You must build a game from scratch in a week using Python that relates to this theme. After the jam, your fellow competitors vote on submissions to decide a winner. You can see hundreds of previous submissions to PyWeek at [https://pyweek.org/all\_games/](https://pyweek.org/all_games/)

# How can I join?

You can enter PyWeek as an individual or as a team. If you are looking for teammates, you can find fellow PyWeekers in #pyweek on [Python Discord](https://discord.gg/python)! If you want to compete in PyWeek, check out the information on the PyWeek website at [https://pyweek.org/](https://pyweek.org/), you need to register with this site before September 27th (00:00 UTC) in order to participate!

# Where can I find out more?

You can find all the necessary rules and documentation at [https://pyweek.readthedocs.io/](https://pyweek.readthedocs.io/). There are no restrictions on what game library you use as long as the game logic is written in

/r/Python
https://redd.it/ii5r6d
Build Your Own Flight Tracking Application with Python and Open Air Traffic Data

I wrote a tutorial how to build a flight tracking application with Python and Open Air Traffic Data from OpenSky Network. Check out the tutorial and the code.

[https://www.geodose.com/2020/08/create-flight-tracking-apps-using-python-open-data.html](https://www.geodose.com/2020/08/create-flight-tracking-apps-using-python-open-data.html)

[filght tracking application](https://i.redd.it/vg1z387kzpj51.gif)

/r/Python
https://redd.it/ii4oga
APIs.

I recently joined as a Intern in a company mainly assisting in Back End. Now, last day, my frontends developers came to me and asked me to provide the Api . So, does that mean I should be providing all the codes that I have written for APis.?? I developed simple apis using serialization of some models. Now, I should provide the source code and endpoints to that frontend developer? I mean cant he looked into my Github and download the code? I am totally lost.

/r/django
https://redd.it/ii3isd
[News] Apple's AI/ML Residency Program

Apple just announced it's new AI/ML residency program! More details about the program can be found at [https://machinelearning.apple.com/updates/introducing-aiml-residency-program](https://machinelearning.apple.com/updates/introducing-aiml-residency-program). The program is available in multiple locations -- details [here](https://jobs.apple.com/en-us/search?search=%23aimlresidency&sort=relevance).

I'm an ML engineer at Apple Special Projects Group (SPG) in the Applied ML team led by Ian Goodfellow, and I'll be a resident host for this program. To apply to work on my team, please check out [https://jobs.apple.com/en-us/details/200175569/ai-ml-residency-program?team=MLAI](https://jobs.apple.com/en-us/details/200175569/ai-ml-residency-program?team=MLAI).

/r/MachineLearning
https://redd.it/ii18ae
Why Django and Not...

Hey all, I work for a company that's considering a major redo of their e-commerce platform. We're considering a bunch of frameworks for this: Rails, Laravel, Django, and Node. So I thought I'd ask the community here what would be some good reasons for Django over these others? Thanks so much in advance. :)

/r/django
https://redd.it/iiaelg
I created a webapp for generating mock data
https://www.mockerdata.com/

/r/flask
https://redd.it/iiadxc
How to run all cells?

I tried to create a keyboard shortcut for it, but it doesn't work...

​

https://preview.redd.it/l0kzylrsyij51.png?width=879&format=png&auto=webp&s=c6309c76b35effba03f903480745af5d4a245010

/r/JupyterNotebooks
https://redd.it/ihitfy