This media is not supported in your browser
VIEW IN TELEGRAM
Prototype for a garage door monitor/controller using MicroPython and an ESP8266
/r/Python
https://redd.it/8e3fix
/r/Python
https://redd.it/8e3fix
Build an Instagram "Pin" Effect in Python with Dlib
https://www.makeartwithpython.com/blog/instagram-pin-effect-in-python/
/r/Python
https://redd.it/8e80rw
https://www.makeartwithpython.com/blog/instagram-pin-effect-in-python/
/r/Python
https://redd.it/8e80rw
Make Art with Python
Build an Instagram “Pin” Effect in Python with Dlib
Using correlation tracking to pin images in video
Why when SageMath was before Jupyter, only Jupyter was "accepted" in the community? What are the differences between them? I'm NOT talking about CoCalc but SageMath the software
/r/IPython
https://redd.it/8e5una
/r/IPython
https://redd.it/8e5una
reddit
Why when SageMath was before Jupyter, only Jupyter was... • r/IPython
2 points and 0 comments so far on reddit
Cron script to re-save all of a model's instances
I have a pre-save receiver that updates a model with some supplemental information. I'll need to run it every day or so.
While messing around in the shell, I noticed that I have to exit out and restart the shell if I make any changes to my receiver (which I anticipate having to do).
Some googling suggested I should use importlib to reload a package, in this case profiles.models. But it's not working as I expected. Here's my script:
import importlib
import profiles.models
importlib.reload(profiles.models)
for i in profiles.models.Score.objects.all():
i.save()
I get the error:
django.core.exceptions.AppRegistryNotReady:
Apps aren't loaded yet.
Does that mean I can't run this outside of an active and running Django server? What's the right way to do this?
---
Bonus question: It seems computationally expensive to do this for every Score instance every time. If I want to select a random sample of 100 of them, would the right way to do so be this?
Score.objects.all().order_by('?')[:100]
/r/djangolearning
https://redd.it/8e5w3r
I have a pre-save receiver that updates a model with some supplemental information. I'll need to run it every day or so.
While messing around in the shell, I noticed that I have to exit out and restart the shell if I make any changes to my receiver (which I anticipate having to do).
Some googling suggested I should use importlib to reload a package, in this case profiles.models. But it's not working as I expected. Here's my script:
import importlib
import profiles.models
importlib.reload(profiles.models)
for i in profiles.models.Score.objects.all():
i.save()
I get the error:
django.core.exceptions.AppRegistryNotReady:
Apps aren't loaded yet.
Does that mean I can't run this outside of an active and running Django server? What's the right way to do this?
---
Bonus question: It seems computationally expensive to do this for every Score instance every time. If I want to select a random sample of 100 of them, would the right way to do so be this?
Score.objects.all().order_by('?')[:100]
/r/djangolearning
https://redd.it/8e5w3r
reddit
Cron script to re-save all of a model's instances • r/djangolearning
I have a pre-save receiver that updates a model with some supplemental information. I'll need to run it every day or so. While messing around in...
How to structure a custom built admin?
Hey guys, my application is getting much more complex and the inbuilt django admin isn't cutting it anymore.
So I've decided to build a custom admin for our most used flows.
How do I go about structuring this custom admin? Do I make a new app called `custom_admin` and house all the functionality in there, or do I just add a new `custom_admin.py` file to all my existing apps? (since I already have a lot of stuff in `admin.py`), or simply write the views in `views.py`?
One example I found is that `saleor` (a django project) have their custom admin dashboard as a separate app https://github.com/mirumee/saleor/tree/master/saleor/dashboard
How do you guys build a custom admin?
/r/django
https://redd.it/8e9bvd
Hey guys, my application is getting much more complex and the inbuilt django admin isn't cutting it anymore.
So I've decided to build a custom admin for our most used flows.
How do I go about structuring this custom admin? Do I make a new app called `custom_admin` and house all the functionality in there, or do I just add a new `custom_admin.py` file to all my existing apps? (since I already have a lot of stuff in `admin.py`), or simply write the views in `views.py`?
One example I found is that `saleor` (a django project) have their custom admin dashboard as a separate app https://github.com/mirumee/saleor/tree/master/saleor/dashboard
How do you guys build a custom admin?
/r/django
https://redd.it/8e9bvd
GitHub
mirumee/saleor
saleor - An e-commerce storefront for Python and Django
Submitting multiple forms at once?
New to flask, hello :)
I have a page with two forms that are passed in as parameters.
return render_template(
'survey.html',
clientDetailsForm=ClientDetailsForm(),
houseDetailsForm=HouseDetailsForm())
I like having them as seperate forms because they represent seperate concepts.
On my survey.html I have a save button which I would like to save the values of both forms.
Additionally I have a "Send Report" button which ideally would first call the save view, then the sendReport view.
How can this be achieved?
Thanks!
/r/flask
https://redd.it/8e9fj1
New to flask, hello :)
I have a page with two forms that are passed in as parameters.
return render_template(
'survey.html',
clientDetailsForm=ClientDetailsForm(),
houseDetailsForm=HouseDetailsForm())
I like having them as seperate forms because they represent seperate concepts.
On my survey.html I have a save button which I would like to save the values of both forms.
Additionally I have a "Send Report" button which ideally would first call the save view, then the sendReport view.
How can this be achieved?
Thanks!
/r/flask
https://redd.it/8e9fj1
Reddit
reddit: the front page of the internet
r/flask: Flask is a Python micro-framework for web development. Flask is easy to get started and a great way to build web sites and web applications.
Android development using Python?
Does anybody know the best way to develop for Android in Python? I've heard about a lot of packages /etc but no clear answer to "what is the best / standard / working".
/r/Python
https://redd.it/8e9wae
Does anybody know the best way to develop for Android in Python? I've heard about a lot of packages /etc but no clear answer to "what is the best / standard / working".
/r/Python
https://redd.it/8e9wae
reddit
Android development using Python? • r/Python
Does anybody know the best way to develop for Android in Python? I've heard about a lot of packages /etc but no clear answer to "what is the best...
Are there any good continuous testing tools ?
Hello !
The C# team at my company is using a proprietary tool called [NCrunch](https://www.ncrunch.net/) which amongst other things allow us to have tests continiously running the appropriate unit tests when a part of the codebase is modified.
After working some weeks on the C# codebase, I found myself missing this feature when coding in Python.
Do you know a good tool for continuous testing for a Python codebase ?
Thanks in advance for your feedbacks :)
[EDIT 1]: We already have set up continuous integration on our [Jenkins](https://jenkins.io/) server.
[EDIT 2]: I do not try to find a replacement for NCrunch, but instead I am looking for its equivalent for Python codebases :)
[EDIT 3]: Teamates told me about [Wallaby.js](https://wallabyjs.com/) which is an continuous testing tool for JavaScript. If this kind of stuff exists for JS, I am confident that it can be done for Python too !
/r/Python
https://redd.it/8ea9lx
Hello !
The C# team at my company is using a proprietary tool called [NCrunch](https://www.ncrunch.net/) which amongst other things allow us to have tests continiously running the appropriate unit tests when a part of the codebase is modified.
After working some weeks on the C# codebase, I found myself missing this feature when coding in Python.
Do you know a good tool for continuous testing for a Python codebase ?
Thanks in advance for your feedbacks :)
[EDIT 1]: We already have set up continuous integration on our [Jenkins](https://jenkins.io/) server.
[EDIT 2]: I do not try to find a replacement for NCrunch, but instead I am looking for its equivalent for Python codebases :)
[EDIT 3]: Teamates told me about [Wallaby.js](https://wallabyjs.com/) which is an continuous testing tool for JavaScript. If this kind of stuff exists for JS, I am confident that it can be done for Python too !
/r/Python
https://redd.it/8ea9lx
www.ncrunch.net
NCrunch
NCrunch is the ultimate live testing tool for Microsoft Visual Studio and JetBrains Rider. It runs your unit and integration tests so you don't have to, providing inline code coverage and performance metrics while you type.
sqlalchemy queries
I am learning about flask and sqlalchemy and I have a question about the ways to make queries. I have seen three types of querys: cls.query, db.session.query and model.query. I want to know what are, if there are, the differences between these three methods? Or do the do the exact same thing?
/r/flask
https://redd.it/8eb8go
I am learning about flask and sqlalchemy and I have a question about the ways to make queries. I have seen three types of querys: cls.query, db.session.query and model.query. I want to know what are, if there are, the differences between these three methods? Or do the do the exact same thing?
/r/flask
https://redd.it/8eb8go
reddit
sqlalchemy queries • r/flask
I am learning about flask and sqlalchemy and I have a question about the ways to make queries. I have seen three types of querys: cls.query,...
manage.py migrate: [migration_name] just needs the first few characters
EDIT: looking at the comments I think I should add some context. Say you did a migration and want to undo the database changes (so it doesn't screw up future migrations), you can run `manage.py migrate [app_label] [migration_name]` where migration_name is the filename of the previous migration you wish to revert to. What's not clear in the docs is that you can actually use just the first few characters of the filename, so long as there are no clashes.
---
I feel silly for not trying this before, but when doing `manage.py migrate app_label migration_name` you can actually just use the first few characters of a migration for `migration_name` e.g. if your migration file is 0018_auto_20170802_1822.py, you can just use `manage.py migrate app_label *0018*`.
This works because the function to get the migration uses `startswith()`: https://github.com/django/django/blob/master/django/db/migrations/loader.py#L134
Hope this helps if you're trying to undo a previous migration!
/r/django
https://redd.it/8eal1n
EDIT: looking at the comments I think I should add some context. Say you did a migration and want to undo the database changes (so it doesn't screw up future migrations), you can run `manage.py migrate [app_label] [migration_name]` where migration_name is the filename of the previous migration you wish to revert to. What's not clear in the docs is that you can actually use just the first few characters of the filename, so long as there are no clashes.
---
I feel silly for not trying this before, but when doing `manage.py migrate app_label migration_name` you can actually just use the first few characters of a migration for `migration_name` e.g. if your migration file is 0018_auto_20170802_1822.py, you can just use `manage.py migrate app_label *0018*`.
This works because the function to get the migration uses `startswith()`: https://github.com/django/django/blob/master/django/db/migrations/loader.py#L134
Hope this helps if you're trying to undo a previous migration!
/r/django
https://redd.it/8eal1n
GitHub
django/django
django - The Web framework for perfectionists with deadlines.
DjBrut: bruteforce protection for Django with Redis backend. Customizable, extendable, fast.
https://github.com/orsinium/django-bruteforce-protection
/r/django
https://redd.it/8ed2og
https://github.com/orsinium/django-bruteforce-protection
/r/django
https://redd.it/8ed2og
GitHub
orsinium/django-bruteforce-protection
Bruteforce protection for Django projects based on Redis. Simple, powerful, extendable. - orsinium/django-bruteforce-protection
PyGotham 2018 Call for Proposals
https://www.papercall.io/pygotham-2018
/r/django
https://redd.it/8ec6mc
https://www.papercall.io/pygotham-2018
/r/django
https://redd.it/8ec6mc
www.papercall.io
PaperCall.io - PyGotham 2018
PyGotham 2018 is taking place from October 5-6 at the Hotel Pennsylvania in New York City. It will feature three tracks of talks on Friday, October 5th and Saturday, October 6th.
## Background
PyGotham is a New York City based, eclectic, Py-centric conference…
## Background
PyGotham is a New York City based, eclectic, Py-centric conference…
[AF] Request.referrer gives BuildError when redirecting to the same endpoint.
Hi, so I have a website that enables voting, much like on reddit, and I've tried to make it so that whenever the user votes he is instantly redirected back to wherever he initially viewed a post. So say I upvoted a post when viewing it, I expect to be redirected back to the post, not the front page.
Here is the code I used, taken from a snippet:
def redirect_url():
return request.args.get('next') or \
request.referrer or \
url_for('index')
And here is where it is implemented:
@app.route('/vote/<post_id>', methods=['POST'])
def vote(post_id):
post = Post.query.filter_by(id=post_id).first()
if post != None:
if post.upvotes == None:
post.make_vote_int()
if "upvote" in request.form:
post.upvotes = post.upvotes + 1
post.get_score()
db.session.commit()
if "downvote" in request.form:
post.downvotes = post.downvotes + 1
post.get_score()
db.session.commit()
return redirect(url_for(redirect_url()))
Using this I receive this error:
werkzeug.routing.BuildError: Could not build url for endpoint 'http://localhost:5000/
when voting wherever.
What am I doing wrong and how can I fix it?
Here is the github link, however I haven't yet pushed this code yet.
https://github.com/ModoUnreal/dopenet
/r/flask
https://redd.it/8efkzl
Hi, so I have a website that enables voting, much like on reddit, and I've tried to make it so that whenever the user votes he is instantly redirected back to wherever he initially viewed a post. So say I upvoted a post when viewing it, I expect to be redirected back to the post, not the front page.
Here is the code I used, taken from a snippet:
def redirect_url():
return request.args.get('next') or \
request.referrer or \
url_for('index')
And here is where it is implemented:
@app.route('/vote/<post_id>', methods=['POST'])
def vote(post_id):
post = Post.query.filter_by(id=post_id).first()
if post != None:
if post.upvotes == None:
post.make_vote_int()
if "upvote" in request.form:
post.upvotes = post.upvotes + 1
post.get_score()
db.session.commit()
if "downvote" in request.form:
post.downvotes = post.downvotes + 1
post.get_score()
db.session.commit()
return redirect(url_for(redirect_url()))
Using this I receive this error:
werkzeug.routing.BuildError: Could not build url for endpoint 'http://localhost:5000/
when voting wherever.
What am I doing wrong and how can I fix it?
Here is the github link, however I haven't yet pushed this code yet.
https://github.com/ModoUnreal/dopenet
/r/flask
https://redd.it/8efkzl
GitHub
ModoUnreal/dopenet
dopenet - The ideal template to make websites in 2018!!!! (I'm kidding of course)
AI based keyboard for disabled people. (In python using tensorflow)
https://youtu.be/YLNDTA2cE1Q
/r/Python
https://redd.it/8ejf2m
https://youtu.be/YLNDTA2cE1Q
/r/Python
https://redd.it/8ejf2m
YouTube
AI based handwriting keyboard
this is a keyboard I created to help disabled people to use computers using a neural network.
I shipped my first real Django project, an easy way to make your own job board
Hey there y'all! I recently built [Seeker](https://seeker.company), an easy way for people to make their own paid job boards. I built this using Django in the back-end with Django Rest Framework and Vue.js on the front-end. Postgres is the database (hosted in Google Cloud) and it's deployed to Heroku.
/r/django
https://redd.it/8egd1h
Hey there y'all! I recently built [Seeker](https://seeker.company), an easy way for people to make their own paid job boards. I built this using Django in the back-end with Django Rest Framework and Vue.js on the front-end. Postgres is the database (hosted in Google Cloud) and it's deployed to Heroku.
/r/django
https://redd.it/8egd1h
seeker.company
Seeker is the easiest way to host your own job board!
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/8ekob5
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/8ekob5
reddit
What's everyone working on this week? • r/Python
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your...