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
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
Saturday megathread: Share your resources!

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/imr8h6
Discrepancy in logging output between IDLE and Terminal

import flask

app = flask.Flask(__name__)

@app.route("/")
def about():
return hello

if __name__ == "__main__":
app.run(debug=True)

When the code is executed and I visit [http://localhost:5000/](http://localhost:5000/) , I get a NameError exception page from the debugger, which is expected. However, the stderr output in the shell differs:

IDLE

================= RESTART: /Users/eExamSystem/Documents/app.py =================
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat

IDLE Without Debugger (For comparison)

================= RESTART: /Users/eExamSystem/Documents/test.py =================
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2020-09-05 17:57:38,774] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)


/r/flask
https://redd.it/imylhc
I made a Spotify ad stopper because I was too poor for Premium. It automatically detects when an ad plays and then restarts Spotify in the background. It's my first project after escaping tutorial hell and I'd love any feedback you guys have!

It detects when an advertisement plays by monitoring the type of what track is currently playing, using the Spotipy api. It then closes and opens Spotify by the os module and plays it via pynput.

There have been a few programs in this subreddit which offer a similar functionality but mute spotify, and play another locally-stored song. I preferred not using that method and hence did this.

The code is present below, and is also present in my github repo [here](https://github.com/SakDev/SpotiByeBye).

Once again, I truly would appreciate any constructive feedback!

**Edit**: Thank you so much for your positive response!!!! I've added a readme file to help anyone understand the gist of setting up the Spotify API to get your Client ID and secret.

And to all the people who claim this is stealing, I just wanted to say that while it does test ethical bounds, this program merely restarts Spotify using legally-obtained data from Spotify. Chill dude.

​

https://preview.redd.it/prkuja5q6cl51.png?width=4560&format=png&auto=webp&s=36f824adc24665e71d497aeb7e8afde5b1f2e9f7

/r/Python
https://redd.it/in1pyu
What are the uses of vue.js and react with django ? How they are useful in django ?

Right now i am learning django. I know basics about python. I see many tutorials about django+react and django+vue.js for making webapps but I want know when to use vue.js or react with django.

/r/django
https://redd.it/in3jvb
Sunday megathread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/inbwja
I wrote a mass emailing script named MassEmailer that you can input any sized text file of email addresses and an email body text file and it will mass send out the email. You can schedule it to send a set amount of emails per day to stay within provider limits until it has been sent to all emails.

[https://github.com/trevtravtrev/MassEmailer](https://github.com/trevtravtrev/MassEmailer)

The readme contains all the instructions you should need to run it. The code has docstrings explaining each function. It works perfect but would like to hear feedback for how it can be written to be more user friendly. Please feel free to critique here or use the code in any way you'd like. Please make sure to follow the readme to get the script running for yourself.

I currently have a 5,000 email address text file and 1 text file with the email body text. I have it set to send 100 emails per day via gmail (this is gmail's limits) and it is set to run once every 24 hours with windows task scheduler. It deletes email addresses from the text file as it sends to them so it can run seamlessly the next scheduled time picking up where it left off. Keep a backup copy of your email list elsewhere.

If this is popular, I will add updates and maybe even make an interface.

/r/Python
https://redd.it/imufvd
How to have encrypted chat between users, where the site owner cant read any of the messages?

* The messages would be stored in the database
* Im guessing this will deal with hashing
* The site owner should not be able to read any of the messages
* Users will be private messaging other users
* Is there any common lib/tool/package that can be used with Django to accomplish this?

/r/django
https://redd.it/ing5h4
testing in django

Hey, does anyone knows some good django testing examples to learn from?

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