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
How to Create a Grocery Delivery And Pick-up Service App in Python

In this project, we will build an online grocery store web application using Django 3.0 and PostgreSQL with third-party libraries.

[https://www.education-ecosystem.com/brahim\_chougrani/2PEBk-how-to-create-instacart-clone-with-django/voGEG-porject-introduction/](https://www.education-ecosystem.com/brahim_chougrani/2PEBk-how-to-create-instacart-clone-with-django/voGEG-porject-introduction/)

/r/djangolearning
https://redd.it/gvee7s
What are the exact uses of flask's SECRET_KEY

Hi, I just finished my project which I built with flask and I'm still not sure what the SECRET\_KEY is used for.I saw multiple answers over the web and wanted to be sure what's the correct one.I saw that the SECRET KEY is used for:

1. The csrf token in the forms ( { form.csrf\_token } ).
2. To encrypt the session id in the cookies (or something like that).

I want to know which one is correct (maybe both)My second question is: Is wekzeug.security.generate\_password\_hash uses it as well?

/r/flask
https://redd.it/gvekun
Integration with PostgreSQL: for a newbie

Hey All,

I am new to Django, could someone explain how Django integrates with PostgreSQL? I don't understand why my Django app is throwing errors, it is saying that my IP address is not found, yet I am running it on localhost.

/r/django
https://redd.it/gvljrx
Any suggestion to find a remote Python job ?

I have worked as a python engineer(good at Django,Flask, Celery,MySQL, redis, influxdb and so on) for two years in China. Recentlly I am thinking about to find a remote job ,can anyone give me some suggestion ? THX:)

/r/django
https://redd.it/gvotnm
I'd like to host a small Flask project, and I had some questions about the database

I've been using sqlite 3 for development, and I found the options of Postgresql or Mysql if I want to host my project and have other people use it.

Does anyone have any recommendations on which one to use? I think that the one I use will be dependent on whether I can find a free plan for the database on a host. I do not want to pay for a database because this is a learning project. A database host with a limited free plan will be great, so which one do you recommend?

Free Postgresql:

* Heroku
* [https://www.elephantsql.com/plans.html](https://www.elephantsql.com/plans.html)

Free Mysql:

* [https://remotemysql.com/](https://remotemysql.com/)
* [https://www.freemysqlhosting.net/](https://www.freemysqlhosting.net/)
* [https://www.db4free.net/](https://www.db4free.net/)
* [https://www.freesqldatabase.com/freemysqldatabase/](https://www.freesqldatabase.com/freemysqldatabase/)

Which one would you recommend?

Another question, should I download ALL of the database devtools for postgresql and mysql to my computer? I'd like to view the database directly and make changes if required, but I was wondering if you think Flask-Admin is enough

/r/flask
https://redd.it/gvotyl
Periodically update information on a page without reloading

I would like to have my program automatically updating stock prices, percentage change, etc. of certain stocks (that I'll have listed in a file) on a Flask website every minute.

How would I go about doing this? How can I periodically retrieve and update the information every minute without reloading the page? From some research, I understand that you have to do it with AJAX, but I do not understand fully how to implement it. Is there a better/easier way to do it with Flask?

Any help is appreciated!

/r/flask
https://redd.it/gvrg9b
Noob Question : When to use third party apps/packages/libraries instead of creating my own solution?

Lets say I want to make a SaaS or production quality projects in Django. Should I build everything from scratch and use only the popular 3rd party apps like allauth etc and build everything else from scratch. Or should I use 3rd party solutions wherever it fits and saves me time and effort?


Also, What are the best practices while using 3rd party apps?


P.S. - Can mods add an ASK flair?


TIA!

/r/django
https://redd.it/gvtl8r
This media is not supported in your browser
VIEW IN TELEGRAM
Finished a program that draws images with epicycles!

/r/Python
https://redd.it/gvnyx5
How to know if a bound method needs (self, obj) arguments?

In writing a method for an admin.TabularInLine object where I wanted to render an image inline when viewing its parent object, I discovered that I had to pass in two arguments (self, obj) rather than just one (self). So far, whenever I've added functions to models, I've always just passed in (self).

How would I know how whether I had to include either or both of those particular arguments? Is it in the documentation somewhere? Thanks

EDIT:

class ImagesInLine(admin.TabularInline):
model = Images
readonly_fields = ('image_html',)
fields = ('image_html','image', 'order', )

def image_html(self, obj):
html = '<a href="None" target="_blank"><img src="None" /></a>'
return format_html(''.join(html.format(url=obj.image.url)))

/r/djangolearning
https://redd.it/gw07a5
[P] 181 NLP Colab Notebooks Found Here!

\*UPDATE\* Super Duper NLP Repo

Added 41 new NLP notebooks, bringing us to 181 total! Several interesting topics from information retrieval to knowledge graphs included in this update. Thank you to contributors David Talby and Manu Romero.

[https://notebooks.quantumstat.com/](https://notebooks.quantumstat.com/)

/r/MachineLearning
https://redd.it/gvsh51
What are these numbers to the left of each cell?

Hi,

I'm trying to learn Jupyter and Python, however, I'm not sure what the numbers enclosed in brackets on the left side of each cell are. Also, why do they not proceed one by one, and instead jump around a lot?

/r/IPython
https://redd.it/gw1bhc
[D] Paper Explained - Learning To Classify Images Without Labels (Video Analysis)

[https://youtu.be/hQEnzdLkPj4](https://youtu.be/hQEnzdLkPj4)

How do you learn labels without labels? How do you classify images when you don't know what to classify them into? This paper investigates a new combination of representation learning, clustering, and self-labeling in order to group visually similar images together - and achieves surprisingly high accuracy on benchmark datasets.

&#x200B;

OUTLINE:

0:00 - Intro & High-level Overview

2:15 - Problem Statement

4:50 - Why naive Clustering does not work

9:25 - Representation Learning

13:40 - Nearest-neighbor-based Clustering

28:00 - Self-Labeling

32:10 - Experiments

38:20 - ImageNet Experiments

41:00 - Overclustering

&#x200B;

Paper: [https://arxiv.org/abs/2005.12320](https://arxiv.org/abs/2005.12320)

Code: [https://github.com/wvangansbeke/Unsupervised-Classification](https://github.com/wvangansbeke/Unsupervised-Classification)

/r/MachineLearning
https://redd.it/gvty17
Flask API need to incorporate in flask Template

I am new with flask... Created a flask app with REST API and template both.

I have divided my project in two-part... I mean the same project has api.py for API and app.py for the web app (flask template). API is running on 3009 port and the web app is running on 3010.
I have added JWT token and all are working in API. From the web app side, I am calling APIs for each action.
When I am calling API via postman all login functionality is working as expected. but the same I want to incorporate in UI.
For example: Like when we do API and using that in UI side like reactJS.. in the same way, I want to incorporate with my flask web app. 
How I can check the user is login or not on the web app side?

/r/flask
https://redd.it/gw6l67
Skew reduction automator

I'm interested in the applicability of automated skew correction for setting up a ML model. So I've made this function that automates skew correction given some skew cut off range (Further explanation on its workings are in the readme.

[https://github.com/CormacCollins/Automated\_skew\_reduce](https://github.com/CormacCollins/Automated_skew_reduce)

I'm new in the data science domain, I'm a Computer Science graduate who had an interest in analytics/statistics. And I'm trying to get some practice on Kaggle data sets (Plenty of practice time as an unemployed grad). Now I know it's important of course to explore the dataset to pick the best features, but I guess I was interested in how good a model could be made by purely automated fixing of the data (such as the correction of skew). I will often look at the popular workbooks to get some best practice insights, and sometimes peoples methods for dealing with skew can be quite arbitrary. Now I've seen people correct the skew of a distribution with something like the log function, and I found a good example article on a few of the functions used here ([https://towardsdatascience.com/top-3-methods-for-handling-skewed-data-1334e0debf45](https://towardsdatascience.com/top-3-methods-for-handling-skewed-data-1334e0debf45)). I've used these functions in my automation. I've also read about the general rule of thumb being that skew is considered big if outside

/r/pystats
https://redd.it/gw5gnp
Simple site to export tables on DB to CSV

I have a couple of tables in a `.db` file. I’d like to create a simple site with Flask that allows users to select a table out of the database and then export it as a `.csv` file. All the example I find online are too complex, or are focused on creating User/Login schemas.

I've added this to my `routes.py` file.

import sqlite3 as sql
import os
import csv
from sqlite3 import Error

conn = sql.connect("LocalEconData.db")

tables = []


def sql_fetch(con):
cursorObj = con.cursor()
cursorObj.execute('SELECT name from sqlite_master where type= "table"')
rows = cursorObj.fetchall()
tables.append(rows)
return tables


sql_fetch(conn)


@app.route("/tables", methods=["GET"])
def dropdown():


/r/flask
https://redd.it/gw1iyv
In the context of Django, how does a 'Reddit Front Page' or 'Instagram Feed' work?

When someone visits the Instagram feed, or the 'Explore' feed everyone sees something different. How does this work in practice? It seems like its a lot of data to process for each person, yet it happens instantly.

I know they have custom algorithms to do this, but in reality how does it process it so fast?

In practice, I visit my instagram feed which calls a View function. How does it create my front page in such little time?

/r/django
https://redd.it/gw47xs