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
PyCharm users: Why do you prefer it over VSCode or other editors

After some very spirited arguments from VSCode users, I'd like to turn it around and ask PyCharm users the same thing: why do you use PyCharm and not VSCode or another modern text editor?

Is it deeper integration with language/framework features? Is it the plugin ecosystem? Or the shortcuts?

Disclaimer: I'm a PyCharm Pro user myself. ;-) But I must say, when I do anything outside of Python/Django, I use VSCode 95% of the time. Not that it's that much, but still.

/r/Python
https://redd.it/kxoflx
Django based crypto currency dashboard

Just finished a new django based crypto dashboard project that I thought this sub might enjoy. It uses Bootstrap, is hosted with Heroku and hits the CoinGecko API.

coinquote.co

/r/django
https://redd.it/kxjgr8
Uploading file on local Storage for Flask on Heroku.

I've build this web app that takes pdf file from user and store it in a folder inside my project. My code is working fine on local server. Whenever I upload file, it gets uploaded in the designated folder but when I host my app on Heroku, I'm not being able to upload file anymore. Could you please help me in figuring it? Thanks.

/r/flask
https://redd.it/kxk8rn
How to export data from JSON file to database

models.py
class Stock(models.Model):
company = models.CharField()
sector = models.CharField()
per_asset = models.DecimalField()

serializers.py
class StockSerializer(serializers)
class Meta:
fields = '__all__'

views.py
class StockAPI(generics.ListCreateAPI):
queryset = Stock.objects.all
serializer_class = StockSerializer


I scraped down the stock informations for my model, in a dictionary and dumped dictionary to a JSON output file.
This is going to be one time scraping to load the data. But I am not sure what will be the next step going forward, how can I export the data from JSON file to my Stock model database?

/r/django
https://redd.it/kxqoc9
Anyone used scipy.optimize?

Trying to get my head around the scipy optimize library and especially minimize function. Part of it is the bewildering assortment of methods like Brent and Krylow methods etc. Are their any good tutorials on using the multivariate versions of these? I am having trouble with the minimization terminating early without deviating far from my initial x0. Any thoughts?

/r/IPython
https://redd.it/kxqi4d
Tutorial: React/SPA with httpOnly Django Sessions instead of JWT Authorization

Hey all, I've created an honestly somewhat-dysfunctional tutorial on how to integrate Django httpOnly cookie sessions with React for the sake of security and avoiding stateless authorization on browsers. I couldn't find any tutorials online that included httpOnly cookies, and honestly the DSF is pretty negative against JWTs (and JS accessible session cookies...). So here's a full breakdown tutorial!

https://github.com/Andrew-Chen-Wang/SPA-with-sessions

The demo is found here: https://acwpython.pythonanywhere.com/authenticated/ When you go to the authenticated URL, you'll find your session cookie and csrftoken set. (You can change the csrftoken to also be httpOnly in the settings). Static is deployed on GitHub pages every time you update the React app and does not delete old static files in case of delays in server deployment.

Please provide feedback! Also look at issue #3 of the repo. I just have haunting memories of working on SimpleJWT (disclaimer, I'm a maintainer) + JWT Authorization integration to becoming httpOnly cookies at PR #157.

/r/django
https://redd.it/kxyudo
Site themes: pitfalls to look out for?

I have a Django e-commerce project I am working on, and while I'm capable of getting the front-end all themed up nice and pretty, I'm looking at simply purchasing a pre-built theme from Themeforest or a similar provider.

Obviously I can't just go find a Wordpress or Shopify theme or something. I assume it should pretty much just be plain HTML+CSS+JS and I will have to modify the markup in their templates to be used with Django's templating syntax, but outside of that, is there anything specific I should avoid?

I've always just built my own front-end stuff but this time I'd like to skip that since I'm in a time crunch and pretty much any typical theme that has the basics will be good enough for me.

/r/django
https://redd.it/ky2v49
Django concurrent users estimate

I want to build an E-learning platform with Django and wanted to know aprox. how many concurrent users can an average Django web app handle right off the bat, with no optimization, since i want to make a pretty agressive marketing strategy and not feel bad about choosing Django. Want to host the app on linode, their 20$/40$ VM.


I know it depends on a lot of factors, but from your own experience?

/r/django
https://redd.it/ky4yac
Live flight sim tracker built in flask

I got fed up with the terrible visual map in Microsoft Flight Simulator.

I wanted a solution that would allow me to load a visual map of my plane location on a separate device - iPad, phone, chromebook, laptop.

So I built an app comprising: a small client which runs on the computer running the flight simulator, which sends flight data to a flask server which then serves up a visual map.

It uses flask, javascript, bootstrap and leaflet.js for the mapping.

​

https://preview.redd.it/bdbpojfidib61.png?width=930&format=png&auto=webp&s=5bd74be2059b72473f50d80de801272c49918f12

Website: https://findmyplane.live/

Server repo: https://github.com/hankhank10/findmyplane-server

Client repo: https://github.com/hankhank10/findmyplane-client

/r/flask
https://redd.it/kxvvyc
Saturday Daily Thread: 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/ky7bib
Django rest - Testing

Hi!

Im my work im using django rest framework with Reactjs an im testing the frontend. My question is, is there any way that i can make a mock database just for testing in a request made in the frontend? idk if im clear about the question, let me know

thanks in advanced

/r/django
https://redd.it/ky3jfe
Second version of my first Django App

I want to show you how my project is going. The first pic is when I was learning django basics and the last one is the app with django + vuejs.

​

Learning Django basics \(How it started\)

​

Current version built with DRF + Vue.js \(How it's going\)

​

Left aside on hover event

Rigth now i'm very happy for the results and I'm very close to have a mvp of this app so I want to know if you guys want to help me proving that, looking for possible bugs and giving me feedback when this app be ready.

Also I want to know if you would like that I write a blog telling how I built it or what was my learning proccess or tell me what kind of thing you would like that I write about.

/r/django
https://redd.it/kyc3yy
How can I perform push notifications in flask?

The only library I can find that the provides what I need is called Flask-Notifications but is no longer hosted on pypi and it is almost 6 years old now. Is there any modern flask library or something similar that allows me to perform web push notifications?

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