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
Domain Tree Structure Best Practices?

I'm curious as to what judgement criteria is generally used when organizing the placement of apps (or sections) of a website within the tree structure?

In particular, when is it best practice to place an app name in front of your domain www.appname.domain.com vs behind it www.domain/appname.com? Is this related more to SPA's?


/r/django
https://redd.it/8atrk0
Combinations in Python

Need help counting the different ways I can get 10 pairs of couples from a ballroom dance club with 10 males and 12 females to choose from. I was thinking importing itertools would be helpful.

/r/Python
https://redd.it/8auuzu
[D] Machine Learning - WAYR (What Are You Reading) - Week 44

This is a place to share machine learning research papers, journals, and articles that you're reading this week. If it relates to what you're researching, by all means elaborate and give us your insight, otherwise it could just be an interesting paper you've read.

Please try to provide some insight from your understanding and please don't post things which are present in wiki.

Preferably you should link the arxiv page (not the PDF, you can easily access the PDF from the summary page but not the other way around) or any other pertinent links.

Previous weeks :

|1-10|11-20|21-30|31-40|41-50|
|----|-----|-----|-----|-----|
|[Week 1](https://www.reddit.com/r/MachineLearning/comments/4qyjiq/machine_learning_wayr_what_are_you_reading_week_1/)|[Week 11](https://www.reddit.com/r/MachineLearning/comments/57xw56/discussion_machine_learning_wayr_what_are_you/)|[Week 21](https://www.reddit.com/r/MachineLearning/comments/60ildf/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 31](https://www.reddit.com/r/MachineLearning/comments/6s0k1u/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 41](https://www.reddit.com/r/MachineLearning/comments/7tn2ax/d_machine_learning_wayr_what_are_you_reading_week/)|||
|[Week 2](https://www.reddit.com/r/MachineLearning/comments/4s2xqm/machine_learning_wayr_what_are_you_reading_week_2/)|[Week 12](https://www.reddit.com/r/MachineLearning/comments/5acb1t/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 22](https://www.reddit.com/r/MachineLearning/comments/64jwde/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 32](https://www.reddit.com/r/MachineLearning/comments/72ab5y/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 42](https://www.reddit.com/r/MachineLearning/comments/7wvjfk/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 3](https://www.reddit.com/r/MachineLearning/comments/4t7mqm/machine_learning_wayr_what_are_you_reading_week_3/)|[Week 13](https://www.reddit.com/r/MachineLearning/comments/5cwfb6/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 23](https://www.reddit.com/r/MachineLearning/comments/674331/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 33](https://www.reddit.com/r/MachineLearning/comments/75405d/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 43](https://www.reddit.com/r/MachineLearning/comments/807ex4/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 4](https://www.reddit.com/r/MachineLearning/comments/4ub2kw/machine_learning_wayr_what_are_you_reading_week_4/)|[Week 14](https://www.reddit.com/r/MachineLearning/comments/5fc5mh/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 24](https://www.reddit.com/r/MachineLearning/comments/68hhhb/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 34](https://www.reddit.com/r/MachineLearning/comments/782js9/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 5](https://www.reddit.com/r/MachineLearning/comments/4xomf7/machine_learning_wayr_what_are_you_reading_week_5/)|[Week 15](https://www.reddit.com/r/MachineLearning/comments/5hy4ur/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 25](https://www.reddit.com/r/MachineLearning/comments/69teiz/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 35](https://www.reddit.com/r/MachineLearning/comments/7b0av0/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 6](https://www.reddit.com/r/MachineLearning/comments/4zcyvk/machine_learning_wayr_what_are_you_reading_week_6/)|[Week 16](https://www.reddit.com/r/MachineLearning/comments/5kd6vd/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 26](https://www.reddit.com/r/MachineLearning/comments/6d7nb1/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 36](https://www.reddit.com/r/MachineLearning/comments/7e3fx6/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 7](https://www.reddit.com/r/MachineLearning/comments/52t6mo/machine_learning_wayr_what_are_you_reading_week_7/)|[Week 17](https://www.reddit.com/r/MachineLearning/comments/5o
b7dx/discussion_machine_learning_wayr_what_are_you/)|[Week 27](https://www.reddit.com/r/MachineLearning/comments/6gngwc/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 37](https://www.reddit.com/r/MachineLearning/comments/7hcc2c/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 8](https://www.reddit.com/r/MachineLearning/comments/53heol/machine_learning_wayr_what_are_you_reading_week_8/)|[Week 18](https://www.reddit.com/r/MachineLearning/comments/5r14yd/discussion_machine_learning_wayr_what_are_you/)|[Week 28](https://www.reddit.com/r/MachineLearning/comments/6jgdva/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 38](https://www.reddit.com/r/MachineLearning/comments/7kgcqr/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 9](https://www.reddit.com/r/MachineLearning/comments/54kvsu/machine_learning_wayr_what_are_you_reading_week_9/)|[Week 19](https://www.reddit.com/r/MachineLearning/comments/5tt9cz/discussion_machine_learning_wayr_what_are_you/)|[Week 29](https://www.reddit.com/r/MachineLearning/comments/6m9l1v/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 39](https://www.reddit.com/r/MachineLearning/comments/7nayri/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 10](https://www.reddit.com/r/MachineLearning/comments/56s2oa/discussion_machine_learning_wayr_what_are_you/)|[Week 20](https://www.reddit.com/r/MachineLearning/comments/5wh2wb/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 30](https://www.reddit.com/r/MachineLearning/comments/6p3ha7/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 40](https://www.reddit.com/r/MachineLearning/comments/7qel9p/d_machine_learning_wayr_what_are_you_reading_week/)||

Most upvoted papers two weeks ago:

/u/marcossilva_604: https://arxiv.org/abs/1802.06006.

/u/hohomomo1212: Learning to Play with Intrinsically-Motivated Self-Aware Agents (https://arxiv.org/abs/1802.07442). It is a paper on a form of reinforcement learning without extrinsic rewards. Think of a robot wandering around in the world without being told what to do but instead figuring out what to do by itself using a model of its own abilities. That's why they call it self-aware. Pretty cool :)

Besides that, there are no rules, have fun.

/r/MachineLearning
https://redd.it/8aluhs
What are some fun things to do with Python?

I became fluent in Python a few years ago but never used it for anything besides assigned coursework or job related tasks. I’ve been looking to apply my skills in a way that would inspire me to excel while being enjoyable and have been having a fairly hard time with it.

So what are the most fun things you’ve used Python for that can be turned into a long term hobby?

/r/Python
https://redd.it/8axg0p
Never put DEBUG = True in any django server that is accessible from outside your LAN

While this is quiet obvious and must have already read it in django docs, many people (me included) still do it sometimes.

**Why?**

Mainly because ~~most recommended django configurations,~~ Django doesn't serve static/media files if `Debug = False`. So you might be tempted to temporarily set `Debug = True` while your client is reviewing the website and making the final changes before deployment.

**Why `Debug = True` is Evil?**

When any exception happen, django expose all your settings, environment variables to the world.
Remember that `SECRET_KEY` settings that django tells you never reveal? It's there for anyone across the globe to view freely.
Database password? Yep, it's there also.
Email credentials? API for external services? All there.

I know some of you would call me stupid for setting `Debug = True` on a test site that is accessible online and I would agree.
I'm writing this so that no one else would be doing that stupid mistake

/r/django
https://redd.it/8ax6cb
My first automated web scraping for Lego sets.

Using Python and selenium, I made a crude script which web scraps and extracts the Title, item number, Numbers of Pieces and Product Details for different Lego sets.

[Code](https://github.com/WillPhillipsCVdemo/LegoSets_scan/blob/master/Lego_Scan_loop.py)

/r/Python
https://redd.it/8axbvj
store app config in sqlite

I have an app that will be polling info from an api.

I want to be able to store the credentials and other config components in sqlite.

Is there already a framework for this ?

Thanks

/r/flask
https://redd.it/8b0fgc
Django WordPress competitor?

What is the WordPress framework of the Django world? I want to throw up a site that's blog oriented and I'm contemplating brushing up on PHP 7 or just scrapping that and learning Python to throw up some kind of Django solution. Thanks for the direction.

/r/django
https://redd.it/8b3zk1
How do you implement reset password functionality with Django Rest Framework?

Hi devs,

I'm having a bit of trouble to understand this, without DRF I did it successfully by using Django's default auth views and creating my templates but what about DRF?

Should I create a model that stores a token on the database and them verify if the token is valid for the user? If so, how to best generate this token, what to keep in mind to make the implementation as safe as possible?

Can I use Django's own mechanism which, by what I read, takes into account the last login, the current password (?), and adds some salt? This seems to be a very well thought implementation but can I borrow that mechanism into my RESTful views?

How are you (more experienced) guys doing this?

PS: I'm using only Simple JWT, not using other auth libraries like allauth or social login, don't know if this is relevant to the case.

/r/django
https://redd.it/8b3bur
How to submit Form using Ajax in Django

I need to submit an HTML Form using an Ajax call. I don't know why nothing is happening on clicking the button (Upload Files), I checked the browser console but no error.

Here is the code

index.html
https://dpaste.de/2yO4

views.py
https://dpaste.de/rMQm

Complete code
https://www.dropbox.com/sh/2pq1x6tet7td4jq/AAB-l42AQg1w22RRRG-4AUQna?dl=0

/r/django
https://redd.it/8b5pv5
Heroku Django application error!

Hey guys i have created my first django website! and i want to upload it through Heroku, So i followed everything they said to me and i am still getting application error wheni am trying to do
heruko open
I get an application error and as i am beginner to heruko i am frustrated to get errors! I found that i am getting error here while i do
git push heruko master
I get all things ready but a small error after deploying is done and the error is:

Counting objects: 30, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (30/30), done.
Writing objects: 100% (30/30), 13.62 KiB | 422.00 KiB/s, done.
Total 30 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:
remote: -----> $ python manage.py collectstatic --noinput
remote: 118 static files copied to
'/tmp/build_d2ad5fb0675c6c8305a3ad0fb5
819fe4/static', 131 post-processed.
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote:
remote: -----> Compressing...
remote: Done: 54.3M
remote: -----> Launching...
remote: Released v9
remote: https://kiran-portfolio.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/kiran-portfolio.git
dd0eec5..f9d7b19 master -> master
error: update_ref failed for ref 'refs/remotes/heroku/master': cannot lock ref '
refs/remotes/heroku/master': unable to resolve reference
'refs/remotes/heroku/ma
ster': reference broken

I also think the error is with the Procfile because i don't know what name we should type in the wsgi.py as given below:
web: guincorn whatnameshouldiwrite.wsgi

I found that we should write our app name but i have two apps in my project and i have different name for my heroku website and a different name for my project on my PC so which name should i write there?

The heroku logs looks like:

2018-04-10T08:14:54.924974+00:00 app[api]: Enable Logplex by user smschavan143@g
mail.com
2018-04-10T08:14:54.924974+00:00 app[api]: Release v2 created by user smschavan1
43@gmail.com
2018-04-10T08:14:54.816584+00:00 app[api]: Release v1 created by user smschavan1
43@gmail.com
2018-04-10T08:14:54.816584+00:00 app[api]: Initial release by user smschavan143@
gmail.com
2018-04-10T08:15:27.492135+00:00 heroku[router]: at=info code=H81 desc="Blank ap
p" method=GET path="/" host=kiran-portfolio.herokuapp.com request_id=fc6bbee0-4c
46-4896-b597-07c430591135 fwd="45.117.31.196" dyno= connect= service= status=502
bytes= protocol=https
2018-04-10T08:15:31.386132+00:00 heroku[router]: at=info code=H81 desc="Blank ap
p" method=GET path="/favicon.ico" host=kiran-portfolio.herokuapp.com request_id=
daa19840-978e-46f1-9e69-4c031feecdcb fwd="45.117.31.196" dyno= connect= service=
status=502 bytes= protocol=https
2018-04-10T08:28:39.000000+00:00 app[api]: Build started by user smschavan143@gm
ail.com
2018-04-10T08:28:39.000000+00:00 app[api]: Build failed -- check your build logs

2018-04-10T08:29:48.000000+00:00 app[api]: Build started by user smschavan143@gm
ail.com
2018-04-10T08:29:48.000000+00:00 app[api]: Build failed -- check your build logs

2018-04-10T08:30:26.000000+00:00 app[api]: Build started by user smschavan143@gm
ail.com
2018-04-10T08:30:26.000000+00:00 app[api]: Build failed -- check your build logs

2018-04-10T08:31:52.000000+00:00 app[api]: Build started by user smschavan143@gm
ail.com
2018-04-10T08:31:52.000000+00:00 app[api]: Build failed -- check your build logs

2018-04-10T08:34:55.000000+00:00 app[api]: Build started by user smschavan143@gm
ail.com
2018-04-10T08:34:55.000000+00:00 app[api]: Build failed -- check your build logs

2018-04-10T08:41:23.000000+00:00 app[api]: Build started by user smschavan143@gm
ail.com
2018-04-10T08:41:50.953604+00:00 app[api]: Attach DATABASE (@ref:postgresql-ae