What are the most repetitive pieces of code that you keep having to write?
Just wondering, as I often find myself writing similar code throughout my projects
/r/Python
https://redd.it/6bjgkt
Just wondering, as I often find myself writing similar code throughout my projects
/r/Python
https://redd.it/6bjgkt
reddit
What are the most repetitive pieces of code that you... • r/Python
Just wondering, as I often find myself writing similar code throughout my projects
Using Python to find the longest word spellable with symbols from the periodic table.
https://www.amin.space/blog/2017/5/elemental_speller/
/r/Python
https://redd.it/6bgvq1
https://www.amin.space/blog/2017/5/elemental_speller/
/r/Python
https://redd.it/6bgvq1
reddit
Using Python to find the longest word spellable with... • r/Python
160 points and 23 comments so far on reddit
Help fixing flask endpoints
Hello everyone, I had a friend code review a simple to do app that I made with flask. He said that my end points were atypical of a RESTful API and I didn't understand exactly what he meant. He specified by saying that each endpoint should return the specific object that they are manipulating. Could anyone give me some more clarification on this? He doesn't work with python and works with ruby so I had some specific syntax questions. Here's my views.py
https://github.com/snovosel/RESTful_to_do/blob/master/python_todo/views.py
Each view function returns all of the information needed for the front end each time. So i'm not exactly sure what the problem with that is. Hopefully someone can shed some light on this.
Thank you!
/r/flask
https://redd.it/6bn9o1
Hello everyone, I had a friend code review a simple to do app that I made with flask. He said that my end points were atypical of a RESTful API and I didn't understand exactly what he meant. He specified by saying that each endpoint should return the specific object that they are manipulating. Could anyone give me some more clarification on this? He doesn't work with python and works with ruby so I had some specific syntax questions. Here's my views.py
https://github.com/snovosel/RESTful_to_do/blob/master/python_todo/views.py
Each view function returns all of the information needed for the front end each time. So i'm not exactly sure what the problem with that is. Hopefully someone can shed some light on this.
Thank you!
/r/flask
https://redd.it/6bn9o1
GitHub
snovosel/RESTful_to_do
RESTful_to_do - to do list application running on RESTful process with Flask
Good Tutorials on modifying/extending Django Admin site?
Could you folks suggest some good tutorials on modifying/extending Django Admin site?
It would be awesome if they touch on using ajax inside Django Admin. Thank you!
/r/django
https://redd.it/6bknyx
Could you folks suggest some good tutorials on modifying/extending Django Admin site?
It would be awesome if they touch on using ajax inside Django Admin. Thank you!
/r/django
https://redd.it/6bknyx
reddit
Good Tutorials on modifying/extending Django Admin site? • r/django
Could you folks suggest some good tutorials on modifying/extending Django Admin site? It would be awesome if they touch on using ajax inside...
Well documented python ransomeware
https://github.com/VedantGawade/Uzi/blob/master/Uzi.py
/r/Python
https://redd.it/6bn7vl
https://github.com/VedantGawade/Uzi/blob/master/Uzi.py
/r/Python
https://redd.it/6bn7vl
GitHub
VedantGawade/Uzi
Uzi - A Distinctive Ransomeware.
Linux terminal Guake rewritten for Windows, titled WinGuake.
https://github.com/chand1012/WinGuake
/r/Python
https://redd.it/6bofwy
https://github.com/chand1012/WinGuake
/r/Python
https://redd.it/6bofwy
GitHub
GitHub - chand1012/WinGuake: A Windows-oriented version of the popular Guake Terminal for Linux.
A Windows-oriented version of the popular Guake Terminal for Linux. - GitHub - chand1012/WinGuake: A Windows-oriented version of the popular Guake Terminal for Linux.
Group By and Sum Query
Can anyone help me construct a query that looks like https://dpaste.de/fxAf in a view? I've attempted https://dpaste.de/cCar but get an AttributeError.
I'm using django-graphos to pass this into a chart.
/r/django
https://redd.it/6botq2
Can anyone help me construct a query that looks like https://dpaste.de/fxAf in a view? I've attempted https://dpaste.de/cCar but get an AttributeError.
I'm using django-graphos to pass this into a chart.
/r/django
https://redd.it/6botq2
Failed to save my images in the modelformset_factory using CBV
Hello everyone, I have a challenge. my modelformset_factory does not save the images, although it saves the other form information
http://stackoverflow.com/questions/44018020/my-modelformset-factory-is-not-saving-the-images-i-used-the-class-based-views
/r/django
https://redd.it/6bpfse
Hello everyone, I have a challenge. my modelformset_factory does not save the images, although it saves the other form information
http://stackoverflow.com/questions/44018020/my-modelformset-factory-is-not-saving-the-images-i-used-the-class-based-views
/r/django
https://redd.it/6bpfse
Stackoverflow
My modelformset_factory is not saving the images ( I used the Class based views), but saving it, when using the Admin side
I have a challenge of not saving the image when creating a new product. The form is rendered well and the image is uploaded but never saved until I use the Admin to upload and save it, thats when it
Tips for Building High-Quality Django Apps at Scale
https://blog.doordash.com/tips-for-building-high-quality-django-apps-at-scale-a5a25917b2b5
/r/django
https://redd.it/6brut7
https://blog.doordash.com/tips-for-building-high-quality-django-apps-at-scale-a5a25917b2b5
/r/django
https://redd.it/6brut7
Medium
Tips for Building High-Quality Django Apps at Scale
By Alvin Chow and Bernard Liang, Software Engineers
I made a library that pretty-prints tracebacks and shows you the variables in each frame.
https://github.com/skorokithakis/tbvaccine/
/r/Python
https://redd.it/6bstcu
https://github.com/skorokithakis/tbvaccine/
/r/Python
https://redd.it/6bstcu
GitHub
GitHub - skorokithakis/tbvaccine: A small utility to pretty-print Python tracebacks. ⛺
A small utility to pretty-print Python tracebacks. ⛺ - skorokithakis/tbvaccine
PyCon Sale of Python Books / Online Courses
Educative and I are doing a sale of Python books and courses. I am putting all my books and courses on sale at 50% off for PyCon. Educative does online interactive courses and when you purchase a course, you get **lifetime access**.
Let's start with the Educative courses. To get them for 50% off, you just need to use the following coupons:
* For [Python 101](https://www.educative.io/collection/5663684521099264/5707702298738688) – **au-pycon-reddit-101**
* For [Python 201: Intermediate Python](https://www.educative.io/collection/5663684521099264/5693417237512192) – **au-pycon-reddit-201**
Educative is also putting their [Python 3: An interactive deep dive](https://www.educative.io/collection/10370001/5705097937944576) course on sale for 50% off if you use this coupon: **au-pycon-reddit-deepdive**
Finally they also gave me a coupon for one of other courses: [Coderust 2.0: Faster Coding Interview Preparation using Interactive Visualizations](https://www.educative.io/collection/5642554087309312/5679846214598656) - **au-pycon-reddit-coderust** (Note that this coupon is only 17% off though.
For the eBook (PDF, mobi, epub) versions of my books, I am also doing a 50% off sale on Leanpub:
* [Python 101](http://leanpub.com/python_101/) is free or pay what you want
* [Python 201: Intermediate Python](http://leanpub.com/python201/c/50percent)
* [wxPython Cookbook](http://leanpub.com/wxpythoncookbook/c/50percent)
/r/Python
https://redd.it/6bomkd
Educative and I are doing a sale of Python books and courses. I am putting all my books and courses on sale at 50% off for PyCon. Educative does online interactive courses and when you purchase a course, you get **lifetime access**.
Let's start with the Educative courses. To get them for 50% off, you just need to use the following coupons:
* For [Python 101](https://www.educative.io/collection/5663684521099264/5707702298738688) – **au-pycon-reddit-101**
* For [Python 201: Intermediate Python](https://www.educative.io/collection/5663684521099264/5693417237512192) – **au-pycon-reddit-201**
Educative is also putting their [Python 3: An interactive deep dive](https://www.educative.io/collection/10370001/5705097937944576) course on sale for 50% off if you use this coupon: **au-pycon-reddit-deepdive**
Finally they also gave me a coupon for one of other courses: [Coderust 2.0: Faster Coding Interview Preparation using Interactive Visualizations](https://www.educative.io/collection/5642554087309312/5679846214598656) - **au-pycon-reddit-coderust** (Note that this coupon is only 17% off though.
For the eBook (PDF, mobi, epub) versions of my books, I am also doing a 50% off sale on Leanpub:
* [Python 101](http://leanpub.com/python_101/) is free or pay what you want
* [Python 201: Intermediate Python](http://leanpub.com/python201/c/50percent)
* [wxPython Cookbook](http://leanpub.com/wxpythoncookbook/c/50percent)
/r/Python
https://redd.it/6bomkd
Educative: Interactive Courses for Software Developers
Python 101: Interactively learn how to program with Python 3
Welcome to Python 101! I created this course to help you learn Python 3. My objective is to get you acquainted with the building blocks of Python so that you can write something useful yourself. With interactive playgrounds to help you learn right away, I…
Python, Unicode, utf-16, utf-32.
https://groups.google.com/forum/#!topic/comp.lang.python/-58lTkBBZU4
/r/Python
https://redd.it/6bvc7e
https://groups.google.com/forum/#!topic/comp.lang.python/-58lTkBBZU4
/r/Python
https://redd.it/6bvc7e
Programmatically create a user with python-social-auth
I'm using python-social-auth so that users can log in with their google accounts. However, rather than allowing users to register, I want to programmatically create users given an email associated with their google account. How can I do this?
Thanks!
/r/django
https://redd.it/6btkfo
I'm using python-social-auth so that users can log in with their google accounts. However, rather than allowing users to register, I want to programmatically create users given an email associated with their google account. How can I do this?
Thanks!
/r/django
https://redd.it/6btkfo
reddit
Programmatically create a user with python-social-auth • r/django
I'm using python-social-auth so that users can log in with their google accounts. However, rather than allowing users to register, I want to...
django not logging errors to file when running on nginx
I'm running a django app with uwsgi and nginx. I'm trying to have to django log some 500 errors so I can debug an issue but for some reason it is not writing to the file I've specified when I access my app at its domain. The logging works fine when I manually test the app using uwsgi.
here's my nginx.conf
#nginx.conf
upstream django {
# connect to this socket
server unix:/tmp/uwsgi.sock; # for a file socket
#server 127.0.0.1:8001; # for a web port socket
}
server {
listen 80 default_server;
server_name mysite.org
return 301 https://$server_name$request_uri;
}
server {
# the port your site will be served on
#listen 80 default_server;
#listen 8000;
listen 443 ssl;
root /opt/apps/site-env/trust_site;
# the domain name it will serve for
server_name mysite.org
#Max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /opt/apps/site-env/site/media; # your
Django project's media files
}
location /static {
alias /opt/apps/site-env/site/static; # your Django
project's static files
}
location / {
uwsgi_pass django;
include /etc/nginx/uwsgi_params;
proxy_pass_header X-CSRFToken;
#proxy_set_header X-Forwarded-Proto https;
#proxy_set_header HOST $host;
}
}
help anyone?
/r/django
https://redd.it/6btiwt
I'm running a django app with uwsgi and nginx. I'm trying to have to django log some 500 errors so I can debug an issue but for some reason it is not writing to the file I've specified when I access my app at its domain. The logging works fine when I manually test the app using uwsgi.
here's my nginx.conf
#nginx.conf
upstream django {
# connect to this socket
server unix:/tmp/uwsgi.sock; # for a file socket
#server 127.0.0.1:8001; # for a web port socket
}
server {
listen 80 default_server;
server_name mysite.org
return 301 https://$server_name$request_uri;
}
server {
# the port your site will be served on
#listen 80 default_server;
#listen 8000;
listen 443 ssl;
root /opt/apps/site-env/trust_site;
# the domain name it will serve for
server_name mysite.org
#Max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /opt/apps/site-env/site/media; # your
Django project's media files
}
location /static {
alias /opt/apps/site-env/site/static; # your Django
project's static files
}
location / {
uwsgi_pass django;
include /etc/nginx/uwsgi_params;
proxy_pass_header X-CSRFToken;
#proxy_set_header X-Forwarded-Proto https;
#proxy_set_header HOST $host;
}
}
help anyone?
/r/django
https://redd.it/6btiwt
reddit
django not logging errors to file when running on nginx • r/django
I'm running a django app with uwsgi and nginx. I'm trying to have to django log some 500 errors so I can debug an issue but for some reason it is...
Tutorial: How to determine revenue-maximizing prices in Python
https://www.datascience.com/resources/notebooks/finding-optimal-pricing-to-maximize-revenue-in-python
/r/pystats
https://redd.it/6bpyom
https://www.datascience.com/resources/notebooks/finding-optimal-pricing-to-maximize-revenue-in-python
/r/pystats
https://redd.it/6bpyom
Datascience
Developing a Pricing Strategy to Maximize Revenue
Senior Data Scientist Jean-René Gauthier explains how dynamic pricing can optimize revenue using data science.
How to protect urls
I want to protect my media files, and have done this like so, in url.py:
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from django.views.static import serve
from django.conf import settings
@login_required
def protected_serve(request, path, document_root=None, show_indexes=False):
return serve(request, path, document_root, show_indexes)
urlpatterns = patterns('',
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], protected_serve, {'document_root': settings.MEDIA_ROOT}),
)
and this works, so i can only acces the media file if i am logged in. But i want to be able to grant acces to each file, so not only do you need to login you also need to have acces right to this file, so i made this model.
from django.contrib.auth.models import User
from upload import models as upload_models
class UserVideo(models.Model):
user = models.ForeignKey(User,related_name='_myfiles')
file = models.ForeignKey(upload_models.Document)
def __str__(self):
return u'%s - %s' % (self.user, self.file)
its a list of users and what video each user can see, so i can do something like:
myfiles = request.user._myfiles.all()
and get all the files.
how do i protect the url, so instead of checking if i am logged in, it also check if i have acces to it in this model? is this possible to do in the url.py ?
/r/djangolearning
https://redd.it/6bvae0
I want to protect my media files, and have done this like so, in url.py:
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from django.views.static import serve
from django.conf import settings
@login_required
def protected_serve(request, path, document_root=None, show_indexes=False):
return serve(request, path, document_root, show_indexes)
urlpatterns = patterns('',
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], protected_serve, {'document_root': settings.MEDIA_ROOT}),
)
and this works, so i can only acces the media file if i am logged in. But i want to be able to grant acces to each file, so not only do you need to login you also need to have acces right to this file, so i made this model.
from django.contrib.auth.models import User
from upload import models as upload_models
class UserVideo(models.Model):
user = models.ForeignKey(User,related_name='_myfiles')
file = models.ForeignKey(upload_models.Document)
def __str__(self):
return u'%s - %s' % (self.user, self.file)
its a list of users and what video each user can see, so i can do something like:
myfiles = request.user._myfiles.all()
and get all the files.
how do i protect the url, so instead of checking if i am logged in, it also check if i have acces to it in this model? is this possible to do in the url.py ?
/r/djangolearning
https://redd.it/6bvae0
reddit
How to protect urls • r/djangolearning
I want to protect my media files, and have done this like so, in url.py: from django.conf.urls import patterns, include, url from...
Top 15 Python Libraries for Data Science in 2017
https://activewizards.com/blog/top-15-libraries-for-data-science-in-python/
/r/Python
https://redd.it/6bvwvn
https://activewizards.com/blog/top-15-libraries-for-data-science-in-python/
/r/Python
https://redd.it/6bvwvn
ActiveWizards: data science and engineering lab
Top 15 Python Libraries for Data Science in 2017 | ActiveWizards: data science and engineering lab
In this article we wanted to outline some of the most useful Python libraries for data scientists and engineers based on our experience.
Using Flask for big applications as E-commerce
I've been using Flask for the last couple of years, but I just developed small applications for the companies that worked for.
I'm willing to develop a big e-commerce web system with Flask, but I don't know if it's gonna last. Based on my researches, Flask was never used on a application like that.
Well, shoud I try?
Thanks!
/r/flask
https://redd.it/6bwn2k
I've been using Flask for the last couple of years, but I just developed small applications for the companies that worked for.
I'm willing to develop a big e-commerce web system with Flask, but I don't know if it's gonna last. Based on my researches, Flask was never used on a application like that.
Well, shoud I try?
Thanks!
/r/flask
https://redd.it/6bwn2k
reddit
Using Flask for big applications as E-commerce • r/flask
I've been using Flask for the last couple of years, but I just developed small applications for the companies that worked for. I'm willing to...
Custis Trail Bike Count Forecaster
https://georgetsilva.github.io/posts/custis-trail-bike-count-forecaster/
/r/pystats
https://redd.it/6bqklv
https://georgetsilva.github.io/posts/custis-trail-bike-count-forecaster/
/r/pystats
https://redd.it/6bqklv
Data EconoScientist
Custis Trail Bike Count Forecaster
In this article, I will step through the process of forecasting the number of bicycles traveling on the Custis trail daily by using sophisticated machine learning techniques. Originally, I was planni
What if range did not exist?
https://aroberge.blogspot.se/2017/05/what-if-range-did-not-exist.html
/r/Python
https://redd.it/6bvrkk
https://aroberge.blogspot.se/2017/05/what-if-range-did-not-exist.html
/r/Python
https://redd.it/6bvrkk
aroberge.blogspot.co.uk
What if range did not exist?
Over the years, various proposals for new syntactic constructs have been put forward to supplement or replace the range() function for loop...