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
How do I optimise my Django project for speed and performance?

Hey guys, hope you are all doing well. I recently deployed a django app to Heroku and it is super slow (5 - 6 seconds on average for a page), in part because I live in India and that's also where the majority of my users are. However, I recently tried shifting my site to AWS Lambda on the Mumbai server, which resulted in RELATIVELY faster load times (2 - 3 seconds for non database pages; pages that fetch stuff from the database are approximately the same if not even slower). This led me to believe that my site may be genuinely slow because the code isn't very efficient. To confirm this, I tested the response times locally using Google Chrome Dev tools. Sure enough, the site pages were taking 1 - 2 seconds on avg. to load locally. For comparison, I also checked the response time locally for a django blog project I had done earlier, and it was around 100 - 200 milliseconds. My current Django app is actually a marketplace, and is a fair bit more complicated than the blog, but it still shouldn't be 10X slower. Any tips on how I can make it faster /

/r/django
https://redd.it/ij6ud0
How to integrate a machine learning model from Azure?

I built a machine learning model on Azure platform and want to connect it to the web app using Dash(which is built upon Flask) and the model changes continuously with the data. How do I connect the ml model with the web app?

/r/flask
https://redd.it/ij8ai0
PyCon India 2020!

Ticket sales for PyConIndia2020 are open.

Rush to get your ticket: [https://in.pycon.org/2020/#ticket](https://in.pycon.org/2020/#ticket)

PyCon India is the annual gathering of Pythonistas, run by the Indian Python community, to foster adoption of the Python programming language.

With over 250+ proposals coming in globally, job board, workshops, dev sprints, and networking opportunities. This year PyCon India 2020 is set to be the biggest one yet.

We will be having a job board where you can find exciting job openings from various companies that uses Python and related technologies in various domains like web, infra, security, embedded, or data science.

No matter if you are a student, someone who is just starting out with Python, a seasoned programmer, or looking for your first programming gig there is something for all.

To make the event inclusive and accessible to all, we have kept the ticket prices to a bare minimum of 199 INR, or roughly 2.68 USD.

Regards,

On Behalf of PyCon India Organising Team

https://preview.redd.it/2owzws0q06k51.jpg?width=1280&format=pjpg&auto=webp&s=27d11d5f1b1e20d61a748801798628c6eabf93b8

/r/flask
https://redd.it/ijfczy
Jupyter notebook on tablet?

Is there such a thing? I am on android. I am not necessarily looking to install a native android app. Just the web version isn't easy to use on tablet. Like how do you even alt-enter or ctrl-enter on a tablet keyboard?

Maybe not even the full functionality of jupyter but is there a mobile website for such a thing?

/r/JupyterNotebooks
https://redd.it/ij7hj6
I made a terminal-based presentation tool with colors and effects!

Hey everyone, I made `present` which is a terminal-based presentation tool with some extra goodies! You can write slides using Markdown (I also plan to add Jupyter notebook support) and also play codios (pre-recorded playable code blocks) which can be useful for live demos! Here's the [code on Github](https://github.com/vinayak-mehta/present). And here's a demo:

​

https://i.redd.it/ei6flui6i5k51.gif

/r/Python
https://redd.it/ijdmca
Monday megathread: Project ideas!

Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code!

/r/Python
https://redd.it/ijnjcu
Django and react

Hi there,

I'm a senior ruby developer who is now working on a fair big project made in django.

With ruby on rails there are many ways to integrate a react project inside the common views and I'd like to know what's the best practice within the django community?

​

I don't want to move everything on react because just a small part of the project really need it and moving everything to react would mean an heavy rewriting.

/r/django
https://redd.it/ijvuz0
[D] Simple Questions Thread August 30, 2020

Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

Thanks to everyone for answering questions in the previous thread!

/r/MachineLearning
https://redd.it/ijkivz
Tuesday megathread: Advanced questions

Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.

**If your question is a beginner question we hold a beginner megathread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.**

/r/Python
https://redd.it/ik9o9r
My First GUI Application

I know it's not anything special, but GUIs have always been one of my biggest weaknesses. I haven't had any good projects to show off because whenever I get to the point where I need a GUI, I get discouraged and start working on a different project. I finally sat down and forced myself to learn Pygame this past week and today I spent the whole day coding up this beauty.

Okay, maybe it's not that beautiful, but you've gotta start somewhere. I busted my ass making this thing all day and I'm damn proud of it. Hope you all like it too =)

https://reddit.com/link/ikbcaz/video/6d3qy2hpyfk51/player

/r/Python
https://redd.it/ikbcaz
I created a collection of notebooks related to Computer Vision.

Hi everyone!

I have been putting together all my personal stuff of everything related to **Computer Vision** and organizing them in a collection of *python notebooks* as neat as possible. (I am always updating this project with new content)

I hope someone find it useful.

Link to the collection page: [Computer Vision Notebooks](https://diegoinacio.github.io/computer-vision-notebooks/)

​

https://preview.redd.it/9c3yddh77fk51.png?width=1280&format=png&auto=webp&s=8fc79b63f8312bb7b99d80a27e2a8046fc017bc3

/r/Python
https://redd.it/ik91eq
Django Channels - Is better to isolate the WebSocket Server?

So I have a Django application with React front-end through an API (django-restframework) and I would like to implement some websocket action (real time events) with Django Channels, is it better to create another server, just to websocket connections or integrate all in one application? I know it would change to ASGI, but don't know what it can causes or malfunction with HTTP connections after that. Thanks in advance.

/r/django
https://redd.it/ikkcm0
What are best options for pure Flask API schema UI

I am using flask for making an API with various endpoints so I wonder how to showcase my API beautifully documented as I don't plan on developing frontend for it.
I am avoid hight level extensions for the restful endpoints functionalities as I am trying to learn more about what's going under the hood.
So, I wanna use an extension only for schema UI generation and I wonder what are the best options there !

/r/flask
https://redd.it/ikh5u7
URL not found

Hey!

I've just started my first problem and I've run into a problem. I get a 404 when trying to run the given code with the given template. Does anyone see the issue?

https://preview.redd.it/0uprbg4e2kk51.png?width=434&format=png&auto=webp&s=0dcfe3ed359fb97248e1d960d849585ab02e6273

https://preview.redd.it/7fmbxk4e2kk51.png?width=545&format=png&auto=webp&s=96227087d1981dce3b99d92a09eba237e65b8678

The issue occured when I added {content} (i have no idea how this is called) in the html file.

/r/flask
https://redd.it/ikn4z3
HW help

Hey there,

I'm taking a programming class (zero experience with programming) as an elective and ran into some difficultly. My professor is asking to me to use the quadratic formula by plunging in the values given. For some context, leading up to this assignment we have discussed f strings, different types of print functions, and conversion functions. I'm not asking for someone to just give me the necessary code language, but rather hints and clues so I can figure it out on my own. I find programming really interesting and I want to be able to nail the fundamentals.

/r/IPython
https://redd.it/ikwww2
Class 'builtins.list' is not mapped

@seller_bp.route('/dashboard/products/', methods=['GET'])
def product_page():
return render_template('/seller/products.html', message=get_flashed_messages(), products=Products().queryProducts('sellerID', current_user.get_id()))

@seller_bp.route('/dashboard/delete/product/<productID>', methods=['GET'])
def delete_product(productID):
Products().delete(productID)
ProductDelivery().delete(productID)

flash('Product Deleted')
return redirect(url_for('seller_bp.product_page'))

def delete(self, productID):
query = self.query.filter_by(productID=productID).all()
for item in query:
db.session.delete(query)
db.session.commit()

It deletes the product(s) from the database. However it returns an error of:

`sqlalchemy.orm.exc.UnmappedInstanceError: Class 'builtins.NoneType' is not mapped`

I can't figure out what is causing this error

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