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
Best Django Host

I'm working on side project and when it comes to where to deploy it, I still asking myself:

**How can I choose the best host?**

Anyone here knew the best between AWS, [Divio](https://www.divio.com/) or Heroku?

/r/django
https://redd.it/c90cws
The third part of my Python Course is out.

I'm a Game Developer that learned everything I know for free, so I'm giving back. And making a free course that will take anyone from not knowing any programming to making an RPG or similar game, with Python.

So far the course is still only about learning Basic Python, though I use Video Game examples to explain programming concepts. And the exercises are mostly game related.

____

[Everything you need to know BEFORE learning how to Code.](https://www.youtube.com/playlist?list=PLpclOk10VM7gIWyirriII1z4Z7Y-u344n)
This is Episode 0, lots of preamble that I whish someone had told me before I started.

____

[Basics of Python Part 1.](https://www.youtube.com/playlist?list=PLpclOk10VM7inp3AmpFHMDyEJ1RZeleF8)
Variables, Sequences, Conditionals, and loops. It ends with an exercise to make a written adventure game.

____

[Basics of Python Part 2](https://www.youtube.com/playlist?list=PLpclOk10VM7iTl5YuZw8uRfjVYVob9a4l)
Functions, Classes, and Imports. As well as two exercises. The first to refactor the code of the previous exercise using Functions and Classes.
The second to make a TicTacToe game.

The three tutorial videos in part 2, [Functions](https://youtu.be/gtW256tB8wA), [Classes](https://youtu.be/Qdb3r1izA6I), and [Imports](https://youtu.be/2e62ASEQtEM) are all stand-alone, if anyone just wants to learn about those concepts.

____

Learning in this way

/r/Python
https://redd.it/c91if5
Flask with React

I've been programming with python for a while, but I have always been a disaster on web development.

Lately I am studying Flask for Rest API, and I like to work with React on my Node projects, so I tried my best on connecting Flask with React.

I wanted to create several routes with Flask (get,post,put,delete for each object), but I can't find a way to use more than one route on flask connected with React.

I am new to it, so I want a clarification on what I am missing on the equation.

​

If I am going to use React Router, then how do I create the render\_template on Flask for each route?

Sorry if this question is beyond dumb.

/r/flask
https://redd.it/c93hxi
Today I wrote my first password generator.

/r/Python
https://redd.it/c97syu
Help getting values from a nested table

I have created a table (using Django templates) which contains nested inner tables for the ```Attribute``` and ```Value``` columns (these often contain multiple values, and I wanted to keep them in the same row). I am now trying to parse the values from these two columns, and am having a difficult time.

I have written [a function](https://pastebin.com/1c00RAWY) that takes a table id and a column, and returns the values, which works great for the 1st column, but does not work on the nested tables. I've tried parsing the values returned from this function further, expecting that I would just need another nested loop, but to no avail.

I was hoping to parse this table one row at a time, returning the value of the Name, Attributes and Values columns. Does anyone know how I can go about doing this? Is this generally a poor way to layout this data? I tried using rowspan (currently commented out in my code), but with no luck.

[My tables](https://pastebin.com/jNhscb8d).

/r/django
https://redd.it/c9798z
Any tipps for teaching flask for beginners without any preknowledge of python?

Hi y'all!

Soon I will give a little webdevelopment boot camp on Python / HTML / Flask. This is my current rough structure of what I wanna do:

1. Intro to Python, pip and virtualenv
2. Intro to HTML
3. Intro to SQL / Postgres
4. Flask:

* The Request-Response Cycle
* Creating a Homepage
* Templating
* Routes.py
* Static Files
* Creating a database (Postgres)
* Connecting Flask to Postgres
* Writing the User Model
* Creating, rendering and validating a form
* Saving a user to the Database
* Sessions / Sign In / Sign Out

​

Does anyone of you have experience with teaching python to group? I have some concerns, since this is the first time I will teach a rather complex topic to people without any preknowledge:

They will need to install Python, pip, virtualenv, a texteditor such as Brackets and Postgres. Since they will use their personal laptops, I am a little concerned, that there might occur some issues already with getting python running. Do you have some recommendations how to handle the setup? I am especially concerned since they will use

/r/flask
https://redd.it/c96ydp
How to structure my DRF endpoints

So I'm a newb here building my first webapp. The app is supposed to be a social media of the sort and I use React + Redux + Axios to communicate with my backend Django.

​

Now I need to build the search feature, with the option to filter. I want to type in the search bar, a small number of suggestions come up and if I hit the button, every result will appear and I can navigate through them. Of course, if I click on one of the items I'll have detailed information of that item. This is just a side project so no consequences, but I wanna follow the best practice.

​

What's the best way to structure my endpoints?

* One of the seniors in my place said I should give the frontend all the basic information when loading the site, including the item id/ url for later fetches, and let the frontend do the filtering + querying on that set. When the user requests item details, fetch again. Personally I'm not a fan, because even the basic info can be pretty huge and I have no idea how scalable this would be.
* Another way I'm thinking of would be to only

/r/django
https://redd.it/c9czki
Django supporting Budapest Software House Needed

Hi there,

​

I need a few companies supporting Django in Budapest. No, remote is not an option.

BUDAPEST ONLY.

​

Thanx

/r/django
https://redd.it/c9f9kz
queryset with multiple filters

I have a model with multiple projects and multiple categories, each category has updates, the site loops through the projects and displays them in a div block along with the latest update in each category.

I recently discovered "objects.distinct()" which nicely pulls the last items from each project category, which is great, but it pulls the data from the last project only and displays that for each project. Is there a way I can filter the query for project and then get the last item in each category?

​

I seem to be able to either filter for project and get a list of updates in the wrong order, or get the updates correct, but not for each project.

​

models.py

class Update(models.Model):
'''
Latest update must have a category from UpdateCategory
and be linked to a project, all updates are timestamped.
'''
project = models.ForeignKey(Project, on_delete=models.CASCADE)
category = models.ForeignKey(UpdateCategory, on_delete=models.PROTECT)


/r/djangolearning
https://redd.it/c94cw3
Helping adding custom health check using django-health-check

https://github.com/KristianOellegaard/django-health-check

This seems like a really nice Django project. It was really easy to set it up to reporting on my Database. I'm using [Django Q](https://django-q.readthedocs.io/en/latest/) instead of the built in supported Celery, so I'd like to make my own health check.
The README gives an example of how to "Writing a custom health check". But being the Django noob that I am, I don't know where those code examples are supposed to go.

Where in the file structure does the `class MyHealthCheckBackend(BaseHealthCheckBackend):` go? Does it go in a view?

Where does the `class MyAppConfig(AppConfig):` go? Doing some research, I'm guessing I should have, or can add a file named 'my_app/apps.py'?

/r/djangolearning
https://redd.it/c9koea
[D] Is machine learning's killer app totalitarian surveillance and oppression?

listening to the planet money episode on the plight of the Uighur people:

[https://twitter.com/planetmoney/status/1147240518411309056](https://twitter.com/planetmoney/status/1147240518411309056)

​

In the Uighur region every home is bugged, every apartment building filled with cameras, every citizen's face recorded from every angle in every expression, all DNA recorded, every interaction recorded and NLP used to extract risk for being a dissident. These databases then restrict ability to do anything or go anywhere, and will put you in a concentration camp if your score is too bad.

​

Maybe google have done some cool things with ML, but my impression is that globally this is 90% being used for utter totalitarian evil.

/r/MachineLearning
https://redd.it/c9n1u2
Best method for uploading large files (>1GB) to server

i have created a flask application for uploading files to my media server but when i select files through mobile browser (firefox) its getting crashed

is it browser related problem or memory related

will sending files in chunks of data solve this problem ?

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