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
To SPA or not to SPA ? (Existing product)

Backstory:

We've got an existing SaaS product, chugging along with the Django templating engine and an old Bootstrap template bought for $20 several years ago. We're a growing team of mostly backend developers, and now have this nice and fancy 2018 re-design of our dashboard lying in front of us that we need to implement for several reasons (current design is not easily extendable as it was not custom made for our requirements, everyone from clients to sales complains that it looks old and feels chunky, etc..).

From where I'm sitting, we have several options:

1. Hire an experienced frontend developer (that's comfortable with a framework such as React), and have that person tag team with someone from the backend to create an API + SPA.

Pros: Decoupled approach makes things easier/quicker to develop the product further as everyone just concentrates on what they do best.

Cons: Going will be slow as no backend API exists at this point AND we will have to support 2 applications going forward. The complete responsibility of the frontend will lie with the sole frontend developer now and in the future, as we will always be a backend heavy team that will not be able to help with the frontend if necessary.

2. Hire a mid-level frontend developer: stick with Django templates, get frontend dev to upgrade current template to latest bootstrap(or whatever works and is popular these days), and implement new design.

Pros: No API needed, backend team can continue working on product roadmap. Will have to support only 1 app. Backend devs will be comfortable fixing bugs/supporting frontend code if necessary.

Cons: Lose out on super cool new frontend tech(?), oldschool approach ?

3. Hire an experienced frontend developer and do a hybrid approach (page-as-a-component ? [https://hackernoon.com/reconciling-djangos-mvc-templates-with-react-components-3aa986cf510a](https://hackernoon.com/reconciling-djangos-mvc-templates-with-react-components-3aa986cf510a))

I'd love to hear from someone that grew a project and a team and had to face a similar decision. Time and resources are limited here, we have a product roadmap to stick to to stay competitive, and making this frontend upgrade seems almost as necessary as pushing out new features.

Thanks in advance!

/r/django
https://redd.it/8rd4dr
Users, content, and scalability

Hi, I'm looking for some advice on how to go about creating models for, say, a site like reddit. All submitted content can have a number of fields that change over time - upvotes, downvotes, etc. If I try to imagine how that might work, just upvoting a submission and then refreshing the page incurs a number of queries already. How is something like this scalable without just throwing more silicon at the problem? Yes I know of caching but with so many updates, a page from 2 seconds ago is already old.

I guess my questions are: is there an efficient way to keep track of votes or will this inevitably cost many rows? How best to model and write views for scalability? Do sites ever cache pages for several minutes to help mitigate load? Thanks in advance

/r/django
https://redd.it/8rxi41
Looking for very basic django template repository

I'm doing a simple project and am looking for an open-source repo of templates to use, similar to the HTML and CSS the admin module uses.

Does something like this exist? I'm having trouble searching for it because I'm fixating on the word template, which confuses the search results.

Thanks!

/r/djangolearning
https://redd.it/8rwafs
How to support 2 languages in a model CharField?

Suppose I have a Book model that has a Title CharField. I want it to display english and spanish title when the page is displayed in respective language. How to do this? Also is it supported in default admin panel? Thanks!

/r/django
https://redd.it/8ry2bd
Django with RabbitMQ

Is there a way to connect to RabbitMQ without constantly haveing to open and close the connection?

Now I have to open a new connection for every message.

/r/django
https://redd.it/8ryj8u
give an API key for REST flask api

Hello

I made my rest api using flask. and I am using flask-jwt-extended for tokens. each request will generate access and refresh tokens. While testing everything worked perfectly

HOWEVER

I started learning react for my frontend. I pretty much followed this \[modern react with redux by stephen\]([https://www.udemy.com/react-redux/](https://www.udemy.com/react-redux/learn/v4/)). He used api keys on different occasions: youtube api, googlemap api, a weather api and a costume api he made to demonstrate.

Now I have also dealt with twitter and reddit api before. all of them give an "access" key of some sort. This key does not expire and it doesn't need any refresh.

my question is, how to make an "api" key for consumers? or more technically for my front-end usage?

Thank you

/r/flask
https://redd.it/8s2rzu
What's next after basic CRUD?

Hello guys,

It's me again with another dumb question.

I've "finished" few basic apps in my project. I have working CRUD for each app/model and I feel lost now. I'd like to add few things, but I'm not sure what's the best next step

\- Dashboard with charts, maybe few basic forms to add quickly object for specific model

\- Few simple "buttons" to do special actions eg. quickly increase/decrease amount in IntegerField

\- Ability to use custom script (It takes list of IDs and create pdfs of chosen ids), smth like form in which i could add ids and amounts of each id to pass it to the script

What should I do? Things like this require some frontend tools like react? Or can I do it with plain Django?

If I have to use frontend framework, which is better (for project and future job), react or vue?

If I use frontend framework, do I need to create REST API for each app in my project?

Thanks for any advices!

/r/djangolearning
https://redd.it/8s276j
Python is now the most frequent weekly tag on StackOverFlow

/r/Python
https://redd.it/8s2uaf
Overiq Djangobin - A project based tutorial for Django 1.11

Hello everyone!

I have just finished writing Django 1.11 tutorial, where we will build a pastebin application called djangobin.

Tutorial link: https://overiq.com/django/1.11/intro-to-django/

Live Demo: http://overiq.pythonanywhere.com/

Github source: https://github.com/overiq/djangobin


/r/django
https://redd.it/8rz0h4
i have prebinned data. how can i use pandas and seaborn to display histograms based on those bins

see title.

I have csv files of this form

mass (g),count

0-499,600

500-999,2244

1000-1499,3245

...

4500-4999,2095

5000-8165,201



i have 6 such csv files and i'd like to see 6 histograms. the fact that the data is prebinned is giving me issues. i'd appreciate a hint! thanks for your time.

/r/pystats
https://redd.it/8s5tty
MozartFlow: Doing analysis on audio like gender classification, instrument recognition, voice separation, genre classification | Not completed; If anyone interested, do collab.
https://github.com/techcentaur/MozartFlow

/r/Python
https://redd.it/8s6ll7
Need help with chart.js and django.

Im using chart.js to display charts in my django website. I am also using an API call that then parses out JSON data for the chart using python. Does anyone then know how to use an axios call within javascript to call and display the data through my index.html file?

/r/django
https://redd.it/8s89tb
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/8s95kt