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
Deploying Django with Heroku vs Other Options—Which is Best for an Individual Developer??

So I’ve been working on finding the “best” way to deploy a Django site as an individual developer and by far the easiest I have found is Heroku.

Other options require you to essentially become a server admin and spend more of your time on infrastructure than actually building your app.

The major concern I hear about with Heroku is the scaling costs…

…But if you are at the point of scaling, shouldn’t your app be making money to cover those costs?

…Aren’t you also saving tons of time and therefore money by not focusing on your server and related infrastructure??

I don’t get the Heroku hate, it honestly seems like the ONLY decent option for a one-person dev team.

We all use Python and Django so we can move fast and bring our ideas to life, but this ideal seems to get lost as soon as we go to deploy our work to the web.

Id like to hear what you all are doing to solve these issues, and deploy your Django sites in a way that works.

What deployment solution do you think is best for a one-person team whose goal is to build a scalable Django site??

Thanks 🙏

/r/django
https://redd.it/xijzq3
Jupyter Failed to start kernel

Jupyter on vscode is refusing to work and produces this log error:

Failed to run jupyter as observable with args notebook --no-browser --notebook-dir="/home/yamen/Projects/Technocolabs" --config=/tmp/06ba2647-9655-4f4f-a96e-982372e4dfac/jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0
at t.JupyterConnectionWaiter.rejectStartPromise (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:2145420)
at t._error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:2146021)
at t.__tryOrUnsub (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1335464)
at t.error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1334873)
at t._error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1333758)
at t.error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1333452)
at t.error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1330958)
at /home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:7:36891\] {
category: 'jupyterconnection'

/r/JupyterNotebooks
https://redd.it/xhby2a
Rewriting Django Rest Framework app in Flask

I'm working on a Django Rest Framework project that has a chat in it. Now I have a task to create a chat microservice with the same requests and responses as in the DRF project. The problem is that I'm new to Flask. I started searching on how to move a code from DRF to Flask but apparently it's more sophisticated than I expected. Now I'm wondering what would be the best approach for this case.

/r/flask
https://redd.it/xiaeux
Tensorflow on JupyterHub unable to detect GPUs

Hello,

​

Thank you for all the content you provide. It plays a crucial factor in my ML education.

​

I am having problems setting up Tensorflow on JupyterHub to detect GPUs (currently, it only uses a CPU). The end goal and idea is to set up the multi-user JupyterHub interface where I can manage GPU resources that run on the Ubuntu server. Some schemes would look like this:

\-Admin

|- user1: 2 usable GPUs

|- user2: 3 usable GPUs

|- user3: 4 usable GPUs

|- user4: 1 usable GPU

​

Currently, I want to divide and conquer the Tensorflow able to detect and use the GPUs part. With the command "nvidia-smi" in JupyterHub Terminal, where I have installed all TF-related libraries along with Docker, I am able to see all GPUs ( NVIDIA-SMI 460.73.01 Driver Version: 460.73.01 CUDA Version: 11.2). Have you experienced the similar problem, and what will you advise me to do? Is it even possible to manage resources with the JupyterHub interface?

​

Thank you in advance for your time.

​

I am looking forward to hearing from you!

/r/JupyterNotebooks
https://redd.it/xfnisi
[P] I turned Stable Diffusion into a lossy image compression codec and it performs great!

After playing around with the Stable Diffusion source code a bit, I got the idea to use it for lossy image compression and it works even better than expected.
Details and colab source code here:

https://matthias-buehlmann.medium.com/stable-diffusion-based-image-compresssion-6f1f0a399202?source=friends_link&sk=a7fb68522b16d9c48143626c84172366

/r/MachineLearning
https://redd.it/xix8ef
When to use whitenoise to serve static files?

If I am using Django solely as a backend and rest APIs to connect to a javascript front end, should I still use whitenoise? My thought is no, because Django isn't rendering the html/CSS? I am a relatively new developer, so I hope this isn't a dumb question.

/r/django
https://redd.it/xiuiry
Tuesday Daily Thread: 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 Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/xit1rr
How to make a plot with repeating values on the x-axis and that is non-chronological in Jupyter notebook?

I want to plot a graph from sensor data that has time (in the format "hour.minute") on the x-axis and the output (an integer) on the y-axis. The problem is that the time starts at 12.10 PM, takes place over several days and ends at 5.43 PM. I want the graph to show the initial time on the very left and show the rest of the time that follows, with repeated values having their own place on the graph.

I have attached a picture to show what I want the graph to look like, as well as a picture of the Jupyter notebook plot I currently have, and a picture of the .csv file with a look at how the data is arranged, with the measurements starting from the top and ending all the way at the bottom.

/r/IPython
https://redd.it/v7zgw7
Seeking more virtual pair programming buddies for a Django language learning app

I've been developing a language learning app since January and decided to use it as an opportunity to both learn and teach through pair/group programming about two months ago. At that time, I posted here, and we now have a small group of entry to mid level developers working on the app together in both pair/group programming sessions and on our own time.

This has been a wonderful experience for me, so I want to see if others would like to join us as well.

# Details

* We do pair & group programming sessions from 9am-5pm CST (Chicago time), Wednesday - Friday and some Saturdays. Attendees are welcome to join for any portion of the sessions they want.
* We're currently focusing on writing django tests and will soon be implementing more NLP functionality with Spacy. We are also working with the Django rest framework, Google & Bing translation APIs, and we're using a lot of signals. The front end is in React with Ionic.
* The only requirement is that you know and have some experience in Python. I love teaching and can help you setup & learn Django. I'm also an English teacher from the USA: our sessions are good practice for

/r/django
https://redd.it/xjb0kq
Seeking virtual pair programming buddies for a Django language learning app

I've been developing a language learning app since January and decided to use it as an opportunity to both learn and teach through pair/group programming about two months ago. At that time, I posted here, and we now have a small group of entry to mid level developers working on the app together in both pair/group programming sessions and on our own time.

This has been a wonderful experience for me, so I want to see if others would like to join us as well.

# Details

* We do pair & group programming sessions from 9am-5pm CST (Chicago time), Wednesday - Friday and some Saturdays. Attendees are welcome to join for any portion of the sessions they want.
* We're currently focusing on writing django tests and will soon be implementing more NLP functionality with Spacy. We are also working with the Django rest framework, Google & Bing translation APIs, and we're using a lot of signals. The front end is in React with Ionic.
* The only requirement is that you know and have some experience in Python. I love teaching and can help you setup & learn Django. I'm also an English teacher from the USA: our sessions are good practice for

/r/djangolearning
https://redd.it/xjb122
Wednesday Daily Thread: Beginner questions

New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/xjov3k
Django cannot assign must be an instance error

Hello, so i'm trying to add the user that clicked on a button by getting his ID and his trip ID and placing it into a reservation table I have.

views.py (thanks u/drbandre !)

def nbrplaces(request, id):

object = Trip.objects.get(id=id)
object.nbrplaces -= 1
object.save()
print(
object.id)
username = request.user
reser = Reservation(user
id=username, tripid=object.id)
reser.save()
return redirect(index)


Now I get the trip ID correctly and the username as well. But I get this error:

Cannot assign "3": "Reservation.trip
id" must be a "Trip" instance.

Now I tried with name, with just trip with many things but I believe the error is somewhere in my models :l

Here's what the table SHOULD look like: https://imgur.com/a/tsirpbI

Here's what it looks like:

class User(AbstractUser):
pass

class

/r/djangolearning
https://redd.it/xjnm80
Two Scopes of Django 3.x

Anyone read this book?... Is it good...

/r/django
https://redd.it/xjvfua
OpenZiti SDK: make your app secure with embedded zero trust networking

I am happy to introduce OpenZiti Python SDK: .

It allows you to:

* embed zero trust secure networking right into your Python application

* run your Python services without any open network ports.

Powered by: https://github.com/openziti/ziti

/r/Python
https://redd.it/xk3b58
P My co-founder and I quit our engineering jobs at AWS to build “Tensor Search”. Here is why.

My co-founder and I, a senior Amazon research scientist and AWS SDE respectively, launched Marqo a little over a week ago - a "tensor search" engine https://github.com/marqo-ai/marqo

Another project doing doing semantic search/dense retrieval. Why??

Semantic search using vectors does an amazing job when we look at sentences, or short paragraphs. Vectors also do well as an implementation for image search. Unfortunately, vector representations for video, long documents and other more complex data types perform poorly.

The reason isn't really to do with embeddings themselves not being good enough. If you asked a human to find the most relevant document to some search query given a list of long documents, an important question comes to mind - do we want the document that on average is most relevant to your query or the document that has a specific sentence that is very relevant to your search query?

Furthermore, what if the document has multiple components to it? Should we match based on the title of the document? Is that important? Or is the content more important?

These questions arn't things that we can expect an AI algorithm to solve for us, they need to be encoded into each specific search experience and use case.

Introducing Tensor

/r/MachineLearning
https://redd.it/xk31n8