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
Created a google earth like Map app using flask, leaflet and OpenStreetMap

# Map app

[GithubLink](https://github.com/jitendrasinghiitg/dockerised-OSM-Flask-App)

A Flask, Leaflet, OpenStreetMap based map app ,where we can search cities using there postcodes.

Postcode data has been taken from:

* [GeoNames](http://download.geonames.org/export/zip/)

## Demo

https://i.redd.it/4x8a6rq6awk51.gif

/r/flask
https://redd.it/ilpk1q
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/ilio4h
Asynchronous versus synchronous views

Could someone please provide in as much simplified detail as possible the difference in asynchronous and synchronous views and the benefit of and when you should or shouldn't use either one.

/r/django
https://redd.it/ilqmga
Need help to start an e-commerce site on Django.

Hello guys. I am new to django and I want to jump straight in and build an e-commerce site for a friend.
Kindly recommend any books, videos or blogs that will help me on my journey.
Thank you.

/r/django
https://redd.it/iltodg
django chart.js - Query to count all distinct values for particular colum

My goal is to create a query to group together unique 'charges' and count them. Then correctly implementing a for loop, the goal is a pie chart showing multiple slices, each individual slice showing the total count per unique charge.

Currently here is the pie chart https://imgur.com/a/11TLOdC
I would like this to instead show 1 large slice for DUI (2/3) and 1 small slice for Assault (1/3). I think its my query that needs revising, any insight would be appreciated.

# Models.py
class Arrest(models.Model):
number = models.IntegerField()
date = models.DateField()
charge = models.CharField(max_length=64)

# Views.py
def visuals(request):
data = []
labels = []
# Currently my query and maybe the root of the issue
queryset = Arrest.objects.annotate(Count('charge'))

for arrest in queryset:


/r/djangolearning
https://redd.it/iltvaw
Creating a pastebing using Flask

Hello, I am trying to use Flask and thought that a fun way to do that would be to try to implement a pastebin (something like [this one](https://dpaste.com/)) hosted on my own computer. I have started with this [tutorial](https://www.roytuts.com/upload-and-display-image-using-python-flask/) where I learned how to create a website on which I can upload images. Now I want to modify it such that a new sub-website is created everytime I upload an image, like a pastebin. But I have no idea how to do that. Could someone help me figure it out?

/r/flask
https://redd.it/ilwecp
R kernel Jupyter nightmare

Hi thank you for your time,

macOS Catalina Version 10.15.6

2013 Macbook Air

I want to preface this post by saying two things.

1: I am trying to get this program up and running for school and have tried everything I know and understand how to do over the last 2.5 days.

2: Although I followed the instructions of the official IR installation route my computer did not recognize the package and just kept telling me it didn't recognize the phrase IRkernel or irkernel or almost anything else I tried. However, I do have R set up through the R developers download and through Anaconda. So I'm sorry if this isn't the appropriate forum for this but I really don't know where else to turn.

The basic issue I'm having is that I cannot get a jupyter notebook to run my R kernel, it just keeps saying connecting to kernel endlessly and will not allow me to run any code. I have included some screenshots of my jupyter notebook and my terminal window below.

​

https://preview.redd.it/i9dxi6ymqyk51.png?width=1417&format=png&auto=webp&s=6cddae1a1235972d23d3e5fde942c75f28c22996

https://preview.redd.it/lyao4fymqyk51.png?width=1440&format=png&auto=webp&s=48e705030ec4b4e58283af39847b02643d074775

/r/JupyterNotebooks
https://redd.it/ilxbdq
Dynamic drop down list in Django admin

Hey guys, how is it possible to create a dynamic drop down list in Django admin for exemple country and city. Let’s say you have a model for an event, and you have to chose the country and the city from which the event is taking place in Django admin, and making sure once the country is selected, we will have the specific cities related to that country. It would have been easier if it had to let the end sure fill out that form in a template, but I’m still trying to see how this can be done in the Django admin page. Thanks already for your helps.

/r/django
https://redd.it/im0ivs
Django & SEO in digital Marketing

So I recently joined digital marketing company. They hired me for a developer position and ask me to develop seo website, they've been developing website using wordpress but I don't know nothing about wordpress so I told them I can try using django so can anyone tell what approach should I take ?

Please go easy on me I just started learning django, so basically I'm not beginner but also don't have deep understanding in django.

/r/django
https://redd.it/ilwek2
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/im59pd
Symple Data - data the symple way

Hi there,

[this](https://www.symple-data.com/) is a new platform/website for user specific data. We've found that, unlike well known datasets (e.g. weather, population,...), this type of data is not easy to find and/or not free. Help us grow if you agree with us as the value of [this](https://www.symple-data.com/) site grows with its userbase. Visit r/symple_data to post your thoughts or comment below!

/r/flask
https://redd.it/ilz8ws
AutoScraper: A Smart, Automatic, Fast and Lightweight Web Scraper for Python

In the last few years, web scraping has been one of my day to day and frequently needed tasks. I was wondering if I can make it smart and automatic to save lots of time. So I made AutoScraper!

The project code is available on Github: [github.com/alirezamika/autoscraper](https://github.com/alirezamika/autoscraper/)

This project is made for automatic web scraping to make scraping easy. It gets a url or the html content of a web page and a list of sample data which we want to scrape from that page. **This data can be text, url or any html tag value of that page**. It learns the scraping rules and returns the similar elements. Then you can use this learned object with new urls to get similar content or the exact same element of those new pages.

I hope this project is useful for you and saves your time, too.I look forward to hear any feedback or suggestion.

/r/Python
https://redd.it/im6u4b
html syntax in flask

Hiii

I am new to this, I am trying to read an html file with render\_template in my python file(I put it in the right folder), but when I run it and go to the local host I see that the html file hasn't been translated, am I missing something ?

thanks in advance

https://preview.redd.it/u2pgfhz4btk51.png?width=1296&format=png&auto=webp&s=d84be80cedf538dbbc981cae1df1a37ec70fd882

/r/flask
https://redd.it/ilh2tc
How to delete 4 spaces at once?

Sometimes IPython autoindents with extra 4 spaces which I don't want. For deleting the extra indent, I have to press backspace 4 times. Is there any better way to do that?

/r/IPython
https://redd.it/imc2it
Learn how to build a simple Twitter clone using Django and Vue.js (3 hours+)

I love to create tutorials where I can help more people get into programming. The newest video tutorial I have created is called "Learn how to build a simple Twitter clone using Django and Vue.js" and it is around 3 hours long. It thought about doing a series like I have done earlier, but wanted to make one long video instead this time.

​

During this video, you will learn how to build a simple twitter clone / a simple social network. Some of the cool functionality I can mention is following users, direct messages, notifications and feed. You will learn a lot of Django in this video, but I have also used Vue.js to talk to the backend, for validation etc.

​

Here is a list of "tasks" I will go through during this video:

\-Setup and create project
\-Create folders for structure and similar
\-Create app for core views, oinks, userprofiles, notifications
\-Create base html files
\-Create front page with some information
\-Create login and signup page
\-Create page for "my feed"
\-Make it possible to sign out
\-Make it possible to write an oink (Vue.js - Submit and append to list)
\-Make

/r/django
https://redd.it/im9h8n
Implementing JWT Authentication

A DRF beginner here. I'm building a RESTful API using DRF and [`dj-rest-auth`](https://github.com/jazzband/dj-rest-auth). The [docs](https://dj-rest-auth.readthedocs.io/en/latest/installation.html#json-web-token-jwt-support-optional) provides a brief guideline on how to use JWT authentication. It seems like dj-rest-auth is implementing JWT authentication through another package, [`django-rest-framework-simplejwt`](https://github.com/SimpleJWT/django-rest-framework-simplejwt).

The confusing part of this is that SimpleJWT has its own [docs](https://django-rest-framework-simplejwt.readthedocs.io/en/latest/getting_started.html#installation) which explains how one might go about setting up a basic JWT authentication.

The question boils down to this: should I use `"dj_rest_auth.jwt_auth.JWTCookieAuthentication"` or `"rest_framework_simplejwt.authentication.JWTAuthentication"` for my authentication backend? I've tried both, and it seems like they both return the same response, *i.e.* a pair of access and refresh tokens.

I've looked at the [source code](https://github.com/jazzband/dj-rest-auth/blob/master/dj_rest_auth/jwt_auth.py) for dj-rest-auth's JWT authentication backend and have verified that its JWT backend inherits from SimpleJWT's own authentication backend. dj-rest-auth's backend seems to add something related to CSRF. As the team is planning to build a completely decoupled frontend and backend living in subdomains (*e.g.* api.domain.com and www.domain.com), I'm not sure what mode of authentication would be the most optimal.

Thanks in advance for the help and advice!

/r/django
https://redd.it/imda8k
Learn how to build a simple Twitter clone using Django and Vue.js (3 hours+)

I love to create tutorials where I can help more people get into programming. The newest video tutorial I have created is called "Learn how to build a simple Twitter clone using Django and Vue.js" and it is around 3 hours long. It thought about doing a series like I have done earlier, but wanted to make one long video instead this time.

During this video, you will learn how to build a simple twitter clone / a simple social network. Some of the cool functionality I can mention is following users, direct messages, notifications and feed. You will learn a lot of Django in this video, but I have also used Vue.js to talk to the backend, for validation etc.

Here is a list of "tasks" I will go through during this video:

\-Setup and create project
\-Create folders for structure and similar
\-Create app for core views, oinks, userprofiles, notifications
\-Create base html files
\-Create front page with some information
\-Create login and signup page
\-Create page for "my feed"
\-Make it possible to sign out
\-Make it possible to write an oink (Vue.js - Submit and append to list)
\-Make it

/r/djangolearning
https://redd.it/im9hyx
Best Deployment Options for 5 Domains?

I've got three sites ready to deploy, with two more that will be ready in a few months.

What is the cheapest options for doing this without the obvious Heroku, Github, etc?

/r/django
https://redd.it/imjaxr
What's the best way to save files?

I decided to make a website in which certain users can upload files and others users can download them. I saw a video by pretty printed in which he converted the file to bytes and save them to a database but I ended up not doing it that way. I made a folder for the files and saved them there with the `os` module by following [this](https://flask.palletsprojects.com/en/1.1.x/patterns/fileuploads/). Now I'm thinking of making another website that involves saving images, so how should I save images?

Sorry if my English was bad.

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