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
Any good tutorials on pairing Vue with Django?

Ive been using Bootstrap and straightforward HTML files to make everything work but I wanted to start using JS and work with more languages/frameworks. I'm a little confused on how to have django interact with Vue since not only does the framework use HTMLs, but apps/components too. Im still new to Vue frankly so Im not expecting to pop out a beautifully made UI out my ass but I hope I can learn enough from a good tutorial. Thanks for any tips.

/r/django
https://redd.it/ldm7wq
Saturday Daily Thread: Resource Request and Sharing!

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/ldkzyi
New to Django, Need help accessing python manage.py runserver

Hey all,

I just started to learn Django to help build a portfolio that I wish to build. However, as I go through the steps in this website, I run into a bit of a problem that I am not sure how to address. I have managed to make a virtual environment though when trying to run

python manage.py runserver

in the cmd prompt, I am getting an error suggesting that it can't open the file, and there is no such file or directory. I believe I am running Python as an administrator but I can check again if that matters. Below is a picture of what I am getting. If anyone here could lend a hand that would be great!

https://preview.redd.it/cm5kslglzpf61.png?width=1920&format=png&auto=webp&s=7d2a6c92713ee820cb1e7d97f31c96edad108bd0

/r/djangolearning
https://redd.it/ldgnh5
P Building an End-to-End Machine Learning Application From Idea to Deployment

Hey all,

A lot of beginner tutorials out there for using machine learning don't really go beyond copy-pasting some sample code off the Tensorflow website and running it through an overused benchmark dataset.

So I thought I would describe a viable sequence for carrying a machine learning product through a more realistic lifecycle from initial idea to a deployed solution.

The domain is fake news detection and in a series of blog posts I describe:

\- project setup

\- exploratory data analysis

\- building a training/evaluation pipeline

\- error analysis

\- deploying a server and creating a Chrome extension for browser-side interaction

\- building a continuous integration/deployment solution.

Here's the first post in the series and source code. Hope you find it helpful!

/r/MachineLearning
https://redd.it/lds3z1
I've made a really good webcam-based 3x3x3 rubik's cube solver program

TL;DR: here's the project: https://github.com/kkoomen/qbr

The idea came after many years of me solving rubik's cubes in combination with my programming knowledge. I did want to make a program so that even my friends could solve a rubik's cube without knowing anything about it. Hence that I've also added a humanized-notation where all the rubik's cube notation gets converted into humanized sentences such as:

1. Turn the back side 180 degrees.
2. Turn the top layer 180 degrees.
3. Turn the front side a quarter turn to the left.
4. Turn the right side a quarter turn away from you.
...


I've started this project almost 6 years ago when I was still studying and got a decent-working version, but the color detection only worked for my room and my lightning setup. Many things were hard for me since I was still studying programming.

After roughly 6 years (and working professionally for already 6+ years), I got a nice suggestion from someone else on one of my issues on how to improve the color detection using LAB colors + the CIEDE2000 color-distance algorithm. This worked insanely good and got my really accurate results (assuming a room had regular lighting). Due to my knowledge I've built up in the

/r/Python
https://redd.it/ldx3ii
How do you add reactivity to Django templates?

I want to add some reactivity to my website, but I don't want to go the full SPA route. Moreover, I believe Django already does a great work at rendering templates, routing views, etc. So why adding more complications?

I looked into Svelte, but couldn't figure out how to combine it with Django templates, especially in cases where Svelte should display context information from the Django app.

The best I could gather was that Vue, for instance, can combine its own template tags and django tags. Perhaps React can do the same, but must check.

So I wonder, if you want to add some reactivity to the website, what route do you follow? Is there a way of integrating instead of splitting (i.e. instead of making your django app serve an API and your frontend consume it, etc.) that you think is worth exploring?

/r/django
https://redd.it/lduj9l
Moving up from sqlite

I am running a flask web app which requires a lot of database activity. At the moment I am getting around 250,000 database writes and 300,000 database queries a day.

It’s growing fast (20% a day at the moment, with potential for big spikes) and I’m worried that the current setup I have (local SQLite database) will start to creak soon. (I’ve read that 100k a day is the recommended limit).

Questions for you:

- When does SQLite actually start to struggle in a flask setup? What will happen when it does? Performance slowdown or massive explosion with data loss?

- Where is the natural place to graduate to? MySQL? Postgres? Ideally I would like something which requires the absolute minimum of code changes vs the current sqlalchemy/SQLite setup I have. I know zero about database admin/setup.

- How should I think about running the DB server? Run it locally? Cloud? Database access needs to be super quick and intuitively I’m worried that running in the cloud will introduce additional delay - but maybe I’m worried about nothing.

/r/flask
https://redd.it/ldvner
How to Start Machine Learning in python in 2021 for free & 100% online

Here's a complete guide to start and improve in machine learning (ML), artificial intelligence (AI) in 2021 without ANY background in the field. I also share my tips on how I stay up-to-date with the latest news and state-of-the-art techniques.

Video: https://youtu.be/RirEw-uaS\_8
Full guide: https://medium.com/towards-artificial-intelligence/start-machine-learning-in-2020-become-an-expert-from-nothing-for-free-f31587630cf7
GitHub repo with all the links: https://github.com/louisfb01/start-machine-learning-in-2020

/r/Python
https://redd.it/ldyods
I made a data dashboard web app which you can interactively build by writing python code IN the dashboard. It's available as a python package, and contributors are very welcome! (and I actually need some)

https://github.com/phillipdupuis/dtale-desktop

And here is a quick little demo, since a picture is worth a thousand words and all that jazz:

​

https://reddit.com/link/le6lfm/video/f15q4w5f5xf61/player

You can install it via pip install dtaledesktop, and you can run it by either entering dtaledesktop into a terminal or via python code like import dtale_desktop; dtale_desktop.run(). The visualizations are provided primarily by dtale, an amazing tool for exploring pandas DataFrames.

The motivation is to make it simple for researchers/analysts/etc. to organize their python scripts into a functional dashboard. It allows them to run those scripts and explore the data visually by simply clicking a button. They can edit the code or add new scripts at any time, and results/insights can be shared with peers by simply sending them a link.

If anyone is interested in contributing, as long as you know how to use pandas you're probably qualified. What I'm currently looking for help with is building out a library of 'template' data sources for less python-savvy individuals. An example of this could be a template for loading csv files from a remote server -- the user would click "Add Data Source", they would pick the "Remote CSV Files" template, and then they would just plug in the paths to the files

/r/Python
https://redd.it/le6lfm
Outdated Flask extensions

I basically love Flask and its open source culture.

But what I noticed is that some important extensions don't seem to be maintained anymore. For example, flask-restful had its last commit in October last year, and currently 78 issues and 35 pull requests. That looks like that the owners of the repo are not working anymore on this extension. Doesn't that even impose security risks if nobody fixes possible flaws?

/r/flask
https://redd.it/le6htu
I built a URL Shortening Tool which provides Smarter Analytics!

TLDR: Looking for reviews on my first side project: **https://tracer.syscape.live/**

It is a minimal app, which does what it says. Shortens your URL, and provides you with analytics.

Analytics Include:

IP Address
Location of ISP
RAM
OS
Device Brand and Name
Battery Percentage when URL was clicked

​

https://preview.redd.it/hds13y2fawf61.jpg?width=1265&format=pjpg&auto=webp&s=53bb212903289da4eb6d13078ff5b8712a8b0e30

Hey guys, so this lockdown, I built a url shortening service using Flask, DynamoDB, AWS SES, Nuxt.js, AWS Amplify and AWS Lambda.

We also provide these analytics on a user friendly dashboard.

I would much appreciate your feedback on the website. We plan to add much more stuff like map based UI for location, etc.

/r/flask
https://redd.it/le2nap
CONFETTI - The way to start a Django project with Docker

I tried to accumulate best practices that I used for a long time in one project. I hope you'll learn something new from this. It's not a template, it's more like 'copy some piece if you need this'. I will add more stuff, e.g. Redis, Celery... If you find it useful)

Source: https://github.com/funnydman/confetti

Don't hessite to make any improvement, pull requests are welcome.

/r/django
https://redd.it/le15j1
Sunday Daily Thread: 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/leack7
I created a web app that lets you practice trading in the stock market

Address: investick.net

How it works:

You get $500k (virtual cash) and you can start buying and selling stocks and crypto. You can check your performance (day, month, year...) and see how you stack up against others on the leader-board.

​

buying and selling some stocks

​

performance of portfolio and stocks, news about your stocks

​

It's a PWA, which means it's fully responsive and you can "install" it.

It's free without any ads.

​

Tech stack:

Frontend - vue 2, vuetify, chartist for the graphs, gsap for the number transitions. Also vue-cli which is a great tool.

Backend - django, django rest framework.

​

My thoughts about django - overall it's a great framework. I like that it's built in with a great ORM, a user management system and an admin panel. the model system is super easy to work with. My only tiny problem is that I couldn't find a good tutorial/library about how to use session authentication when you have a spa and use django just as a rest api.

​

Ask me anything if something is not clear.

I would love to hear your feedback and ideas on how to improve this :D

/r/django
https://redd.it/leg89q
how does pewee ORM work with heroku for postgress?

Hi there I use peewee for flask and it works fine, even with postgres locally. But, when I go to heroku there is where I am unsure how to proceed. Do I need to statistically type the postgres heroku info ? I cannot seem to find the answer in heroku, some people recommend this #DATABASE=PostgresqlDatabase('heroku'), but it did not work for me. Again thank you!!

​

​

​

DATABASE = PostgresqlDatabase(

'',

user='',

password='', # Ditto.

host='') # Ditto.

​

​

​

​

​

​

​

Thanks

flask-bcrypt==0.7.1 Flask==1.1.1 Flask-CLI==0.4.0 Flask-Login==0.5.0 flask-marshmallow==0.11.0 Flask-Migrate==2.5.3 Flask-Script==2.0.6 Flask-SQLAlchemy==2.4.1 Flask-WTF==0.14.3 gunicorn==20.0.4 bcrypt==3.1.4 flask-peewee==3.0.3 Flask-WTF==0.14.3 Jinja2==2.11.1 lazy-object-proxy==1.4.3 regex==2020.4.4 requests==2.23.0 slugify==0.0.1 SQLAlchemy==1.3.16 sqlparse==0.3.1 urllib3==1.25.8 utils==1.0.1 wcwidth==0.1.9 Werkzeug==1.0.1 wtf-peewee==3.0.0 WTForms==2.2.1

/r/flask
https://redd.it/led12p
I just used Python to grab the rest of the semester's lecture notes in a discrete math class I'm taking!

I've been programming for a long time, but this is the first time I've used it in my day-to-day life! I realized that the lecture notes for a class I'm taking are listed sequentially as urls, so I figured they might be exposed on the server despite not being posted directly on the website. UrlLib to the rescue!

Here's the link to a tiny GitHub repo if anyone's interested.

/r/Python
https://redd.it/leaf6v
How do you mock authentication in flask unit tests (pytest)

How do you guys mock the oauth2 token authentication while writing unit tests in pytest. I have tried pytest-mocks "patch", assigning a simple decorator (which gives back the function itself) to the authentication module and yielding the app. Nothing seems to work, it always goes to the original authentication module when I run the tests. Any ideas?

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