WiPhone: A Phone You Can Program in Python
https://www.kickstarter.com/projects/2103809433/wiphone-a-phone-for-hackers-and-makers/
/r/Python
https://redd.it/bagyxv
https://www.kickstarter.com/projects/2103809433/wiphone-a-phone-for-hackers-and-makers/
/r/Python
https://redd.it/bagyxv
Kickstarter
WiPhone, A Phone for Hackers and Makers
WiPhone is a VoIP mobile phone designed for hackers and makers to be easily modified, repurposed, and adapted.
How does Django handle file upload
If a client uploads a file to my Django server and subsequently in the view I upload that file to some other server, does Django handle this asynchronously? Suppose I’m using Gunicorn. What I’m asking is, while I’m uploading the file to the other server, is my gunicorn worker free to handle a different request while the file is being uploaded?
The reason I’m asking is if this is the case, then I’m going to find an alternate solution as I don’t want my server to become unresponsive if all the workers are busy uploading a file.
As an extension question, is the behaviour Django exhibits common? I.e. if I was using Node can I expect the same behaviour?
/r/django
https://redd.it/baj2a8
If a client uploads a file to my Django server and subsequently in the view I upload that file to some other server, does Django handle this asynchronously? Suppose I’m using Gunicorn. What I’m asking is, while I’m uploading the file to the other server, is my gunicorn worker free to handle a different request while the file is being uploaded?
The reason I’m asking is if this is the case, then I’m going to find an alternate solution as I don’t want my server to become unresponsive if all the workers are busy uploading a file.
As an extension question, is the behaviour Django exhibits common? I.e. if I was using Node can I expect the same behaviour?
/r/django
https://redd.it/baj2a8
reddit
r/django - How does Django handle file upload
2 votes and 11 comments so far on Reddit
Deploy Flask app on Heroku with an Example step by step Screenshots
https://alphazeroerror.blogspot.com/2019/04/deploy-flask-app-on-heroku.html
/r/flask
https://redd.it/badvq2
https://alphazeroerror.blogspot.com/2019/04/deploy-flask-app-on-heroku.html
/r/flask
https://redd.it/badvq2
Blogspot
Deploy Flask app on Heroku with example guide
How to deploy a Python flask app to Heroku using by link your github repository to heroku in free of cost, with free domain , gunicorn flask, Application Error on Heroku python flask app
Python++; The Future is Here!
main.pypp:
from pypp import *
#include <iostream>
#include <vector>
#pragma GCC optimize ("O3")
#pragma GCC target ("avx,avx2")
sync_with_stdio(False);
cin.tie(0); cout.tie(0);
cout << "C++ IO in python, guaranteed ";
cout << 200 << " % speedup" << endl;
a = 0;
b = 0;
a <<= cin;
b <<= cin;
c = "";
c <<= cin;
A = vector<<int>>(5);
A <<= cin;
B = vector<<int>>(4,2);
cout << a << ' ' << b << '\n';
cout << c << '\n';
cout << A << '\n' << B << endl;
pypp.py
import sys
/r/Python
https://redd.it/bajfy1
main.pypp:
from pypp import *
#include <iostream>
#include <vector>
#pragma GCC optimize ("O3")
#pragma GCC target ("avx,avx2")
sync_with_stdio(False);
cin.tie(0); cout.tie(0);
cout << "C++ IO in python, guaranteed ";
cout << 200 << " % speedup" << endl;
a = 0;
b = 0;
a <<= cin;
b <<= cin;
c = "";
c <<= cin;
A = vector<<int>>(5);
A <<= cin;
B = vector<<int>>(4,2);
cout << a << ' ' << b << '\n';
cout << c << '\n';
cout << A << '\n' << B << endl;
pypp.py
import sys
/r/Python
https://redd.it/bajfy1
reddit
r/Python - Python++; The Future is Here!
24 votes and 7 comments so far on Reddit
Can someone better explain flask blueprints to me?
I am curious about the use case for blueprints, I am semi familiar with flask basics but I need to learn about blue prints and all the documentation/tutorials I've viewed still seem cryptic about the fundamental issue blueprints resolve.
/r/flask
https://redd.it/bamhop
I am curious about the use case for blueprints, I am semi familiar with flask basics but I need to learn about blue prints and all the documentation/tutorials I've viewed still seem cryptic about the fundamental issue blueprints resolve.
/r/flask
https://redd.it/bamhop
reddit
r/flask - Can someone better explain flask blueprints to me?
6 votes and 4 comments so far on Reddit
After 4 months, I've finally finished a Finance-related academic thesis written entirely in Python. Here's the source code and accompanying pdf.
https://github.com/rdy1107/TA-thesis
/r/Python
https://redd.it/bandug
https://github.com/rdy1107/TA-thesis
/r/Python
https://redd.it/bandug
GitHub
rdy1107/TA-thesis
Contribute to rdy1107/TA-thesis development by creating an account on GitHub.
I feel like I'm understanding limit_choices_to wrong
Hello. I've read the documentation page on it and searched Google/SO for answers but I just can't seem to wrap my head around it.
I've got the following schema:
class MainModel(models.Model):
pass
class Criteria(models.Model):
parent = models.ForeignKey(MainModel, on_delete=models.CASCADE)
class ChildModel(models.Model):
parent = models.ForeignKey(MainModel, on_delete=models.CASCADE)
What I want to do is have a many-to-many relationship between ChildModel and Criteria, and limit the options of the Criteria to the MainModel's criteria set.
So basically the following:
class ChildModel(models.Model):
parent = models.ForeignKey(MainModel, on_delete=models.CASCADE)
criterias = models.ManyToManyField('Criteria', limit_choices_to=parent.criteria_set.all())
// I want to do this ^^^ (criterias isnt the plural form but bear with me)
But I keep getting errors about the parent not having an attribute "criteria_set" (which I assume would be the way to get the parent's list of criteria)
Am I going about this the wrong way? How would I make it work?
If something's unclear in my question please
/r/djangolearning
https://redd.it/bakda6
Hello. I've read the documentation page on it and searched Google/SO for answers but I just can't seem to wrap my head around it.
I've got the following schema:
class MainModel(models.Model):
pass
class Criteria(models.Model):
parent = models.ForeignKey(MainModel, on_delete=models.CASCADE)
class ChildModel(models.Model):
parent = models.ForeignKey(MainModel, on_delete=models.CASCADE)
What I want to do is have a many-to-many relationship between ChildModel and Criteria, and limit the options of the Criteria to the MainModel's criteria set.
So basically the following:
class ChildModel(models.Model):
parent = models.ForeignKey(MainModel, on_delete=models.CASCADE)
criterias = models.ManyToManyField('Criteria', limit_choices_to=parent.criteria_set.all())
// I want to do this ^^^ (criterias isnt the plural form but bear with me)
But I keep getting errors about the parent not having an attribute "criteria_set" (which I assume would be the way to get the parent's list of criteria)
Am I going about this the wrong way? How would I make it work?
If something's unclear in my question please
/r/djangolearning
https://redd.it/bakda6
reddit
r/djangolearning - I feel like I'm understanding limit_choices_to wrong
1 vote and 0 comments so far on Reddit
Hitting back button on Django form wizard causes page expired error(and nukes all data), particularly on Internet Explorer?
Hey all, creating multi-step forms using django form-wizard and on firefox and chrome it seems to work fine hitting the back and forwards buttons(both using provided buttons and with browser). But using IE, when hitting the browser back button, it said 'Page Expired' and all the data previously entered in the forms was lost.
Any idea how to prevent this or what is going wrong? Thanks guys.
/r/django
https://redd.it/bar7tx
Hey all, creating multi-step forms using django form-wizard and on firefox and chrome it seems to work fine hitting the back and forwards buttons(both using provided buttons and with browser). But using IE, when hitting the browser back button, it said 'Page Expired' and all the data previously entered in the forms was lost.
Any idea how to prevent this or what is going wrong? Thanks guys.
/r/django
https://redd.it/bar7tx
reddit
r/django - Hitting back button on Django form wizard causes page expired error(and nukes all data), particularly on Internet Explorer?
0 votes and 0 comments so far on Reddit
Customizing the user registration flow using django rest-auth for social authentication
I am stuck with a situation and can't seem to find a good solution on how to proceed further. Currently, I am able to authenticate a user using google. So the person is able to create an account and logs in. However, in doing so, the user already has a randomly generated username and all. I want to create a situation where when a user is authenticated via google, they are redirected to a registration form where they can provide a username of their own choice. What is the most efficient way of going about this? My main goal is to ensure that the blacklisted usernames which we can provide in the allauth settings is also utilized when a user provides their own username.
/r/django
https://redd.it/baknw3
I am stuck with a situation and can't seem to find a good solution on how to proceed further. Currently, I am able to authenticate a user using google. So the person is able to create an account and logs in. However, in doing so, the user already has a randomly generated username and all. I want to create a situation where when a user is authenticated via google, they are redirected to a registration form where they can provide a username of their own choice. What is the most efficient way of going about this? My main goal is to ensure that the blacklisted usernames which we can provide in the allauth settings is also utilized when a user provides their own username.
/r/django
https://redd.it/baknw3
reddit
r/django - Customizing the user registration flow using django rest-auth for social authentication
0 votes and 0 comments so far on Reddit
Etch-A-Snap, a Python powered Etch-A-Sketch camera
https://www.twobitarcade.net/article/etch-a-snap/
/r/Python
https://redd.it/bark86
https://www.twobitarcade.net/article/etch-a-snap/
/r/Python
https://redd.it/bark86
Two Bit Arcade
Etch-A-Snap | The Raspberry Pi powered Etch-A-Sketch camera
Etch-A-Snap is (probably) the worlds first Etch-A-Sketch Camera. Powered by a Raspberry Pi Zero (or Zero W) it snaps photos just like any other camera, but outputs them by drawing to an Pocket Etch-A-Sketch screen. Quite slowly. Photos are processed down…
“NameError: global name” Question
Im new to python and flask, however I am not new to programming languages by any means.
I am building a simple web app and something caught my attention that I found kinda strange. (From my point of view)
I added url_for in an html template and it works, however I forgot to import it into my .py script and got an error(as I should)
From my understanding Jinja2 is responsible for the HTML part. Is it safe to say that Jinja2 has all modules imported as part of it base and always readily accessible, therefore never needing “import”?
/r/flask
https://redd.it/baczau
Im new to python and flask, however I am not new to programming languages by any means.
I am building a simple web app and something caught my attention that I found kinda strange. (From my point of view)
I added url_for in an html template and it works, however I forgot to import it into my .py script and got an error(as I should)
From my understanding Jinja2 is responsible for the HTML part. Is it safe to say that Jinja2 has all modules imported as part of it base and always readily accessible, therefore never needing “import”?
/r/flask
https://redd.it/baczau
reddit
r/flask - “NameError: global name” Question
4 votes and 4 comments so far on Reddit
Need help with AJAX calls, and redirect
Hey everyone,
This is my first time using flask and I am looking for some help. The goal of the application is to display most frequent words in lyrics. I have written a class that cleans the data, and pushes dictionary into json file. I currently have the main page (base.html) which accepts artist name, song name, and onclick it generates data into json file. I use chartJS which generates a pie chart for me on a chart.html page, using the data from the json file. I am forced to render\_template to see the chart. My question is, how can I make an ajax request so that on click I can generate the graph in my base.html page after the click?
​
Thank you.
/r/flask
https://redd.it/baat9b
Hey everyone,
This is my first time using flask and I am looking for some help. The goal of the application is to display most frequent words in lyrics. I have written a class that cleans the data, and pushes dictionary into json file. I currently have the main page (base.html) which accepts artist name, song name, and onclick it generates data into json file. I use chartJS which generates a pie chart for me on a chart.html page, using the data from the json file. I am forced to render\_template to see the chart. My question is, how can I make an ajax request so that on click I can generate the graph in my base.html page after the click?
​
Thank you.
/r/flask
https://redd.it/baat9b
reddit
r/flask - Need help with AJAX calls, and redirect
4 votes and 8 comments so far on Reddit
Running Django in Production (Talk Python To Me)
https://talkpython.fm/episodes/show/206/running-django-in-production
/r/django
https://redd.it/batw10
https://talkpython.fm/episodes/show/206/running-django-in-production
/r/django
https://redd.it/batw10
talkpython.fm
Running Django in Production
Let's talk about running Django in production. On this episode, you'll meet Michael Herman who used to work on realpython.com and today is running testdriven.io. We also cover some of the tradeoffs of a set of microservices and a monolith and a round trip…
Need help with Flask API regarding security and JWT
Hello fellows,
​
Long story short, I am developing my API using Flask and I want to secure it against replay attacks and other MITM things, as well as random people querying the address.
​
So I have seen that JWT could be the answer (using secure HTTP of course to prevent those nice MITM) but there is something I definitely can't understand.
​
Once we auth ourself, the server gives us a token, that we are supposed to **store** and send at every request to prove the server we are the real auth person.
But by doing so, considering we send the token using HTTPs so saying like 'okay it's supposed to be enough secure (https) and anyway we won't be querying the api in vulnerable environnement such as public wifi etc..' and considering the token will be linked to a socket right ? Like we link the TOKEN to A USER, for A SESSION therefor the TOKEN is only good for our actual socket (IP/PORT couple), correct me if i'm wrong.
​
So this ensure only *US* at this exact moment can use this token, and not some guy from idk where since that, even if he gets it, he will not have the
/r/flask
https://redd.it/ba7bg1
Hello fellows,
​
Long story short, I am developing my API using Flask and I want to secure it against replay attacks and other MITM things, as well as random people querying the address.
​
So I have seen that JWT could be the answer (using secure HTTP of course to prevent those nice MITM) but there is something I definitely can't understand.
​
Once we auth ourself, the server gives us a token, that we are supposed to **store** and send at every request to prove the server we are the real auth person.
But by doing so, considering we send the token using HTTPs so saying like 'okay it's supposed to be enough secure (https) and anyway we won't be querying the api in vulnerable environnement such as public wifi etc..' and considering the token will be linked to a socket right ? Like we link the TOKEN to A USER, for A SESSION therefor the TOKEN is only good for our actual socket (IP/PORT couple), correct me if i'm wrong.
​
So this ensure only *US* at this exact moment can use this token, and not some guy from idk where since that, even if he gets it, he will not have the
/r/flask
https://redd.it/ba7bg1
reddit
r/flask - Need help with Flask API regarding security and JWT
5 votes and 8 comments so far on Reddit
Python programmers of reddit: what's the most useful tiny little efficiency you've discovered that's improved your programming hugely?
Whether it's default dicts, enumerate, a way to combine functions really efficiently, or whatever, what's the best tiny trick you've discovered that's improved your code massively?
/r/Python
https://redd.it/basnhi
Whether it's default dicts, enumerate, a way to combine functions really efficiently, or whatever, what's the best tiny trick you've discovered that's improved your code massively?
/r/Python
https://redd.it/basnhi
reddit
r/Python - Python programmers of reddit: what's the most useful tiny little efficiency you've discovered that's improved your programming…
597 votes and 452 comments so far on Reddit
Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 3
https://realpython.com/flask-connexion-rest-api-part-3/
/r/Python
https://redd.it/baufsm
https://realpython.com/flask-connexion-rest-api-part-3/
/r/Python
https://redd.it/baufsm
Realpython
Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 3 – Real Python
In this three-part tutorial series, you'll create a RESTful API from scratch to keep track of people and notes using the Flask web framework. You'll also test your API with Swagger UI API documentation. In part three, you'll use SQLAlchemy to provide the…
Is what I'm trying to do even possible?
This might sound really stupid but how can I do something like this:
i = 'profile'
return self.user.i
Where the variable "i" is the attribute.
/r/django
https://redd.it/bb246d
This might sound really stupid but how can I do something like this:
i = 'profile'
return self.user.i
Where the variable "i" is the attribute.
/r/django
https://redd.it/bb246d
reddit
r/django - Is what I'm trying to do even possible?
0 votes and 2 comments so far on Reddit