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
Did anyone took the Vue/Django Course and can recommend it?

[https://courses.djangowaves.com/](https://courses.djangowaves.com/)

​

I'm curious. Anyone took it can tell me if its worth it? I've always had issues with authentication and only found tutorials on how to do toy/demo apps.

/r/django
https://redd.it/bd68qb
Can I get a link to the django Discord Server?

A few days ago I removed the django discord server from my list, and I cant seem to find it again online. I imagined this one was the biggest. It had over 100 people on.

/r/django
https://redd.it/bd6ykp
models.py reserved names; list of all (if using Postgres)?

Ran into an issue earlier today where I was getting a `TypeError` of `int object is not callable` error when trying to save a new entry in a model in the Django admin. Turns out it was because I was using `save` as a field name, ie:

```
save = models.SmallIntegerField(default=0)
```

The error referenced line 1091 of `/usr/local/lib/python3.5/dist-packages/django/contrib/admin/options.py`, which in Django 2.1 is:

```
def save_model(self, request, obj, form, change):
"""
Given a model instance save it to the database.
"""
obj.save()
```

So it appears the `save` field name was overriding the `obj.save()` call above?

I found this:
[Field Name Restrictions](https://docs.djangoproject.com/en/2.2/topics/db/models/#field-name-restrictions)

But is there a list of all the reserved / protected words in Django `models.py`?

/r/django
https://redd.it/bd6o7q
[project] Anyone else is playing with reddit comments using ML in cloud? I'm trying to predict assholes judging from their karma from comments.

Fun categorical classification project, I'd call it ass-o-meter. I queried 1M 2019_01 comments from gbq and running my model on Google colab.

/r/MachineLearning
https://redd.it/bd26o7
Getting SQLAlchemy database instance in Flask

First of all, I'm sorry if this is longish but I can't describe the situation without being explicit, please bear with me.

​

I'm fairly new to flask and I'm building a simple blogging application and am quite confused of the whole application context thing but slowly grasping the concept of it, I want to know what is the better way of doing this which doesn't have any drawbacks. There are 'blog' and 'admin' blueprints for viewing and editing/adding/deleting blogs, respectively. Project layout is something like this:

​

main.py
config.cfg
database.db
blueprints/
--------admin/
------------__init__.py
------------routes.py
--------blog/
------------__init__.py
------------models.py
------------routes.py

I'm going to add another blueprint for 'user' objects and neatly organize everything in django-esque manner, because of this there are no references to main \`app\` object in \`blog.models\` because I don't think it's a good practice to import and define \`SQLAlchemy\` object in every \`models.py\` there might be in future, instead I'm using \`db.init\_app(app)\`

​

This is \`main.py\` file:

from flask import Flask



/r/flask
https://redd.it/bd6g85
Why is pickling such a huge security problem? why is it so frowned upon?

I hear frequently that pickling shouldnt be used if it can be avoided because it is a security risk, but noone ever explains why? and ive tried googling security issues with pickling but i found mostly opinion articles shit talking it and no real tutorials or facts on how to exploit it, or how it could be exploited, or why it is so easy to exploit? can someone please explain to me some of the methods to exploit pickling and why its considered to such a bad practice in the cyber sec world?

/r/Python
https://redd.it/bd8lb0
redirecting pages on django

hi!

i know you guys hate noobs questions, but i suck at researching since english is not my first language and most times i cant find what i want.

on my website, i want to select an option on a dropdown and be redirected to another page with info about this option.
the thing is, i want to use the same template for all the options, only changing the content for each one.

i also want to keep the url like "[http://127.0.0.1:8000/areas/area+3"](http://127.0.0.1:8000/areas/area+3) where area+3 is the option selected (i already managed how to redirect to this url but can't make templates appear, not know how to pass data between pages also)

thanks for your patience!

/r/django
https://redd.it/bd8vi3
Need Help Navigating To The Next and Previous URL Position

I am new to Django and I am using [https://github.com/justdjango/video-membership](https://github.com/justdjango/video-membership) to practice.

[https://imgur.com/aX944tV](https://imgur.com/aX944tV)

From lesson\_detail.html [https://github.com/justdjango/video-membership/tree/master/courses/templates/courses](https://github.com/justdjango/video-membership/tree/master/courses/templates/courses) I want to be able to navigate to the next and previous lesson video positions and their slugs and have a bit of logic that says that the first lesson only has next video (not previous video) displayed and the last lesson only has previous video (not next video) displayed. All other lessons in between the first and last lesson should have both next video and previous video displayed.

Any help would be greatly appreciated as I am unsure how to do this.

/r/django
https://redd.it/bd9qar
I don't know how everyone else learned Python, but the SoloLearn tutorial seems to have been a comprehensive introduction.
https://agentanakinai.wordpress.com/2019/04/15/python-3-tutorial-course/

/r/Python
https://redd.it/bdalsv
Just created a cheat sheet about Support Vector Machines

/r/Python
https://redd.it/bddla1
Using flask-restful with blueprints producing an error

Hi all,

I'm a bit new at this but I'm trying to create a flask app and I have this kind of thing happening in my app.py file:

from flask import Flask
from flask_restful import Resource, Api
from apitest.blueprints.home import home
from apitest.blueprints.api import api_bp

def create_app():
"""
Create a Flask application using the app factory pattern.
:return: Flask app
"""
# instance_relative_config tells flask to look for an instance module that's in the same folder depth as the main module
app = Flask(__name__, instance_relative_config=True)

# look for a settings.py file in the config folder
app.config.from_object('config.settings')

# look in the instance folder for settings.py. Silent = True means don't crash if file doesn't exist
#

/r/flask
https://redd.it/bdcrgg
Seeing a Lot of Posts about Vue.js recently, so frontend frameworks thread it is

Title says it all, seeing a ton of recent interest in Vue.js with Django.

Anyone care to share experience or preference on their frontend framework of choice (don’t want to start a war).

Personally, I’ve been using React recently. Might be overkill for some projects but I just really love the component system, really clean.


**What do you like or dislike or just wanna talk about Vue.js or whichever frontend framework you use with Django :)**

Additionally, what technology do you use alongside these that you recommend?

I’ve only touched the surface of react, and haven’t looked into stuff like WebPack, or browserfy or anything fancy like that, but would love to hear what you guys have to say.

/r/django
https://redd.it/bden00
Struggling with creating modern day webscraping bot

Hi,

I am trying to make a bot in Python for fun utilizing selenium and the requests module. I have run into of trying to trigger a one-click captcha. I am aware that the one-click captcha is not 100% understood but there are techniques to trigger it over the image based one such as browsing youtube videos and signing in and out of gmail.

​

My normal chrome sessions are able to trigger a one-click captcha but my selenium chromedriver session always gets the image.

​

I am curious as to how modern sneaker bots such as aiobot([https://www.aiobot.com/](https://www.aiobot.com/)) are able to make their automation not detectable by chrome.

​

If I am able to trick chrome into thinking I'm not a bot initially, I believe I can then get to the point of watching youtube videos and basically further make chrome have more faith in my selenium session that it is a real human, thus triggering one-click captcha.

​

But does anyone have any thoughts has to how to get my selenium session to act 100% like a normal browsing session?

​

Thanks.

/r/Python
https://redd.it/bdl5wm
Reading in large text data using numba?

I want to read a large text file in and then use numba operations on it (and do this in parallel using prange). Does anyone have any good resources or tips on how to do this?

So far, I tried creating a generator to read text, but numba would not let me pass it in as a parameter (which I'm confused about, because [here](http://numba.pydata.org/numba-doc/0.18.1/developer/generators.html) it mentions that generators are supported by numba.

/r/Python
https://redd.it/bdmnbp
What did Fluent Python help you work on with Django?

I will read it in a few weeks, many recommend it, and I want to know what it helps in the Django scenario. For now, besides the basic python, I just needed to learn decorators and super(), but there is a difference between using a framework and learning to program.

/r/django
https://redd.it/bdndaj
Swagger without DRF?

Hello,

I want to have swagger ui in my project but I don't use Django Rest Framework but all the packages I found are specifically for DRF, like [https://django-rest-swagger.readthedocs.io/en/latest/](https://django-rest-swagger.readthedocs.io/en/latest/)


Is there a package for django that I could use to generate swagger docs without DRF?

/r/django
https://redd.it/bdpxrt