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
Would anyone be interested in an Electronics for Programmers book? If yes, what topics?

With an Electronics background, I sometimes struggle with software paradigms. There are a few python for engineers courses/books out there that I am looking at.

I was wondering if anyone would be interested in the opposite as well. An Electronics for CS/Programmers book/course. And if yes, what are the key areas/topics that confuse you.

Thanks.


/r/Python
https://redd.it/6w1x4z
Looking for open source Django+DRF projects that follow best practices.

The larger the project, the better. If you know of any, please give a link.

/r/django
https://redd.it/6w0hc9
Python refuses to recognize library I am almost certain exists

(i am just copying this from the stackoverflow thread that its not letting me post)

I have no idea why this is so frustrating, but I have literally pulled out a few clumps of hair in rage because this just refuses to work and I honestly do not have the slighest clue on what to do. I am trying to use the winshell module for a quick python programming I am using. I am new to python and just started trying it today. I have tried to install the library manually, and through pip. pip claims the module is downloaded, and I can see it in the `lib` folder. No matter what I do I get this error when I try to run my code:

import winshell
ModuleNotFoundError: No module named 'winshell'

what on earth must I do to get this to work I am at my wits end here and I feel like I'm going to break something

/r/Python
https://redd.it/6w4fb6
ImportError: No module named 'flask_login'

SOLVED:
My flask application isn't using the env but local machine packages, thanks guys!

/r/flask
https://redd.it/6w85r3
Auto creating URLs from user entries?

I have a website I am working on in which users can submit comments, blog entries and such. However, if a URL gets posted, it gets presented as regular text (and thus is not clickable) when the entry is posted. Is there anyway to make Django automatically make links like these clickable?

/r/djangolearning
https://redd.it/6w0p91
Anyone running a subscription site using Django and dj-stripe?

Hello!

So I've got a pretty hefty web app which is currently free and I have a bunch of people happily beta testing it. Simultaneously I've created a dev version and have implemented Stripe on it via dj-stripe. I've got it so I have plans created in Stripe, and created a plans template and view, and attached the form button for one of the plans on the plans page to the "[custom](https://stripe.com/docs/checkout#integration-custom)" implementation of Stripe Checkout. When a user clicks the button, it gives the standard Stripe Checkout pop up and the user can fill in all their data, and on the Stripe end they are attached to a subscription plan and the card is charged (test data of course for now).

Now I'm not sure where to go from here. I assume I need to somehow associate the username in the Django users database with that Stripe plan and then adjust their access accordingly but I'm not sure where to really start with this portion. The Stripe Checkout works great, but I'm not sure how to restrict user access based on which Stripe plan they're associated with. I'm sure this is going to require me to get more involved with the Django database which I am thus far unfamiliar with but I'm ready to learn!

Does anyone have any advice or could someone point me to any info that might help me get started?

Thank you!

/r/django
https://redd.it/6w7vxn
[D] I'm interested in using machine learning to solve process optimization tasks, but I'm really not sure where to look at or where to begin

Title is pretty self-explanatory, I'd like to learn how I can use machine learning for process optimization(tuning a bunch of parameters to get the most optimal output). I'm really just a beginner who doesn't know much more than the basics and I've recently started getting into deep learning etc. but I'd like to apply this for optimization purposes.

/r/MachineLearning
https://redd.it/6wassi
Is templating on <script></script> an acceptable practice in the Django community?

I haven't worked enough with a Django project built by someone else so I can't tell.

There are situations where it is mandatory that javascript must handle information from the server, but in my opinion, performing an AJAX to retrieve this information is too expensive when one could simply put this information in a template.

For instance, when I needed user information to be passed to JS, I did this:

<script>
{% if request.user.is_authenticated %}
const user = {
name: "{{ request.user.first_name }} {{ request.user.last_name }}",
id: {{ request.user.id }}
};
const csrf = "{{ csrf_token }}";
{% else %}
const user = null;
{% endif %}
</script>

The solution works, and I got what I wanted, but it felt too hacky. Is this an acceptable practice or must I look for a better solution? Is this a common thing in Django projects?

/r/django
https://redd.it/6wbki2
Django lookup in new tab/window

Hi guys,
I've been lurking around for quite some time now. I finally decided that I make django application by myself. I am trying to create music library for saving your fav music. I have a form where you can search (its django-autocomplete-light plugin) for music than add some notes and save it. I have more than 250k songs in my database. Now I need your help with search. How could I implement something like a lookup i.e. in form you click on search button that opens new window or tab, then you search for song and when you click it you it closes that window/tab and inserts in form.

I appreciate any help.

/r/django
https://redd.it/6wbxkv
Proper docs and packages for mongodb on django?

i recently started messing around with django, definitely really interesting but im a big mongodb fan and cant seem to find any recent packages, the last django nonrel that i see is 1.6? hopefully im just in the wrong section but i went to the deprecated page and then traversed to the non deprecated(what i hope is non deprecated) and that uninstalled my django 1.11.4 to 1.6 or something around there(i fixed it back to current, the mongodb site is actually kind of off as well, i understand python mainly does better with relational db). sorry exited the shell forgot exact version. if you happen to know/find UP-TO-DATE packages please post a link, thanks in advance

/r/django
https://redd.it/6wf3iz
ls-git: Python executable that enhances ls

/r/Python
https://redd.it/6wfp5o
How do you develop on a remote server?

Hi guys,

i develop primary desktop application, but my next project will be a website for internal use.

My normal workflow is: Write code with PyCharm Community edition on my windows pc, debug and test it locally. After this, deploy it. Because my endtarget are windows clients, this works very well.

Now my next project will be Django on a Linux server with several extensions, who are not a fan of windows. Trust me, tried it, didn't work. So, how do I do this?

Right at the moment I think about using a VM with VMware Player, but I'm afraid about the lagging while writing code all the time on a remote system.

Can anyone recommend a good practice to develop for a remote server?

/r/django
https://redd.it/6wehz1
Quick script to delete your reddit comments

I noticed the tampermonkey script just edits your comments, not deleting them, so I wrote the following script to do both. You'll need to register the app on your account and put in client id/secret



import praw

reddit = praw.Reddit(client_id='',
client_secret='',
password='',
user_agent='deletes my comments',
username='')

redditor = reddit.redditor("")

for comment in redditor.comments.new():
comment.edit(".")
comment.delete()

It deletes your comments most recent to oldest.

Pro tip: make a shell script that includes this code just by adding a shebang followed by a path to your interpreter and run it from there. Also make an alias, helps when you need to find/run this script quickly.


/r/Python
https://redd.it/6wfqsv
[D] would anyone be interested in a machine-learning focused linux distro?

I was thinking about how hard it is to set everything up (CUDA, installing different frameworks, etc) once you put together a new machine...

Would there be any interest in a linux distribution (ubuntu variant) that comes pre-installed with stuff like CUDA, tensorflow, torch, a nice IDE, etc, so you can just install the distro and get started with machine learning stuff right away? I could easily throw something like this together and put it on github or something over the coming long weekend...

Let me know if there is interest and things that I should include in it.

**Edit: made an empty git repo; I'll put stuff there this weekend when I have time to work on it... https://github.com/robbiebarrat/MachineLearningLinux**

/r/MachineLearning
https://redd.it/6wfgfz