New click-web version produces nicer web interface for your command line scripts
The new version 0.7 of [click-web](https://pypi.org/project/click-web/) generates a more polished web interface as well as providing examples of adding authentication and customize CSS.
[click-web version 0.7 screenshot](https://i.redd.it/0np9h07enus21.png)
/r/Python
https://redd.it/bea1n6
The new version 0.7 of [click-web](https://pypi.org/project/click-web/) generates a more polished web interface as well as providing examples of adding authentication and customize CSS.
[click-web version 0.7 screenshot](https://i.redd.it/0np9h07enus21.png)
/r/Python
https://redd.it/bea1n6
PyPI
click-web
Serve click scripts over the web with minimal effort.
How can I run asyncio code in IPython.embed()?
I want to be able to await stuff in embed(). What exactly am I to do?
/r/IPython
https://redd.it/becm4c
I want to be able to await stuff in embed(). What exactly am I to do?
/r/IPython
https://redd.it/becm4c
reddit
r/IPython - How can I run asyncio code in IPython.embed()?
0 votes and 1 comment so far on Reddit
Sonny from Codecademy. We just launched our first ever hardware course in CircuitPython with Adafruit!
Today, we are thrilled to announce the launch of our [Learn Hardware Programming with CircuitPython](https://www.codecademy.com/learn/learn-circuitpython)!
I co-wrote the course with Ladyada and pt of Adafruit so if you have Codecademy Pro, please let me know what you think.
/r/Python
https://redd.it/becxvs
Today, we are thrilled to announce the launch of our [Learn Hardware Programming with CircuitPython](https://www.codecademy.com/learn/learn-circuitpython)!
I co-wrote the course with Ladyada and pt of Adafruit so if you have Codecademy Pro, please let me know what you think.
/r/Python
https://redd.it/becxvs
Codecademy
Learn Hardware Programming with CircuitPython | Codecademy
Learn how to code for various electronic devices in this introduction to hardware programming with CircuitPython.
How to create a page to add related instances?
for example, i have 2 models: Link and LinkCollection. LinkCollection have a title, user etc, and will be used to group instances of links. Ex: Django Links -> Link to page 1, Link to Page 2..., Python Packages -> Link to pckg page 1...
​
I thought about doing something like:
links/collections/<slug:link_collection>/add_link/
​
and in the views:
def form_valid(self, form):
kwargs = super().get_context_data(**kwargs)
collection_slug = kwargs["link_collection"]
collection = LinkCollection.objects.get(slug="collection_slug")
form.instance.collection = collection
form.instance.user = self.request.user
return super().form_valid(form)
​
this would add the instance link, which is handled by Django's CreateView, and would get the collection from the slug. But I think there are some problems with that. For example, the user may try to add getting the slug from a collection of another user etc, since the application will be used with authentication.
​
What is the best way to do this?
/r/djangolearning
https://redd.it/bealn8
for example, i have 2 models: Link and LinkCollection. LinkCollection have a title, user etc, and will be used to group instances of links. Ex: Django Links -> Link to page 1, Link to Page 2..., Python Packages -> Link to pckg page 1...
​
I thought about doing something like:
links/collections/<slug:link_collection>/add_link/
​
and in the views:
def form_valid(self, form):
kwargs = super().get_context_data(**kwargs)
collection_slug = kwargs["link_collection"]
collection = LinkCollection.objects.get(slug="collection_slug")
form.instance.collection = collection
form.instance.user = self.request.user
return super().form_valid(form)
​
this would add the instance link, which is handled by Django's CreateView, and would get the collection from the slug. But I think there are some problems with that. For example, the user may try to add getting the slug from a collection of another user etc, since the application will be used with authentication.
​
What is the best way to do this?
/r/djangolearning
https://redd.it/bealn8
reddit
r/djangolearning - How to create a page to add related instances?
2 votes and 2 comments so far on Reddit
django-bootstrap-modal-forms = A Django plugin for creating AJAX driven CRUD forms in Bootstrap v4 or v3 modals
https://www.reddit.com/r/Python/comments/be40ve/djangobootstrapmodalforms_a_django_plugin_for/
/r/django
https://redd.it/beb5er
https://www.reddit.com/r/Python/comments/be40ve/djangobootstrapmodalforms_a_django_plugin_for/
/r/django
https://redd.it/beb5er
reddit
r/Python - django-bootstrap-modal-forms = A Django plugin for creating AJAX driven CRUD forms in Bootstrap v4 or v3 modals
0 votes and 0 comments so far on Reddit
Embed interactive Jupyter on to my website
would like to build an interactive Jupyter notebook and integrate on my website. So user A could login to my site, type a program which then runs off my cloud.
Pardon if this is a very rudimentary set of requirements as I’m not very Python savvy myself
/r/IPython
https://redd.it/befxx1
would like to build an interactive Jupyter notebook and integrate on my website. So user A could login to my site, type a program which then runs off my cloud.
Pardon if this is a very rudimentary set of requirements as I’m not very Python savvy myself
/r/IPython
https://redd.it/befxx1
reddit
r/IPython - Embed interactive Jupyter on to my website
0 votes and 0 comments so far on Reddit
Web Scraping with Beautiful Soup & Python - A Beginner's Project
Hi guys, a week or two ago I made a [post about web scraping](https://www.reddit.com/r/learnprogramming/comments/b66wrd/web_scraping_with_beautiful_soup_and_python_the/) as a great first step to learning to code and specifically to learn python. You can really be off the ground making something of practical utility with very little time invested.
Although the last example was great I wanted to show everyone how to make a project that can actually be useful in someway using some of this information. I personally find that the best way to learn is by doing something that I can find some practical usefulness in.
So, this time around I wanted to show you guys a truly practical intro project that you can get started on and something similar to what I have been paid for in the past. Now this project is a simplified version of what I made because I can't give away proprietary code for clients for free. That said, it should get you going down the road to building something that can be **very practical.**
​
**Video Tutorial Link -** [**https://www.youtube.com/watch?v=-31Or1HSmyo**](https://www.youtube.com/watch?v=-31Or1HSmyo)
​
**Our Project:**
This project is going to show you guys how you can very quickly and simply create a tool that will monitor a Shopify website by accessing the hidden API, and
/r/Python
https://redd.it/bec60e
Hi guys, a week or two ago I made a [post about web scraping](https://www.reddit.com/r/learnprogramming/comments/b66wrd/web_scraping_with_beautiful_soup_and_python_the/) as a great first step to learning to code and specifically to learn python. You can really be off the ground making something of practical utility with very little time invested.
Although the last example was great I wanted to show everyone how to make a project that can actually be useful in someway using some of this information. I personally find that the best way to learn is by doing something that I can find some practical usefulness in.
So, this time around I wanted to show you guys a truly practical intro project that you can get started on and something similar to what I have been paid for in the past. Now this project is a simplified version of what I made because I can't give away proprietary code for clients for free. That said, it should get you going down the road to building something that can be **very practical.**
​
**Video Tutorial Link -** [**https://www.youtube.com/watch?v=-31Or1HSmyo**](https://www.youtube.com/watch?v=-31Or1HSmyo)
​
**Our Project:**
This project is going to show you guys how you can very quickly and simply create a tool that will monitor a Shopify website by accessing the hidden API, and
/r/Python
https://redd.it/bec60e
reddit
r/learnprogramming - Web Scraping with Beautiful Soup and Python - The Perfect Stepping Stone for Beginners
581 votes and 38 comments so far on Reddit
cool events during pycon?
Are there any cool events during pycon 2019? networking, sponsored events, etc..
/r/Python
https://redd.it/befojw
Are there any cool events during pycon 2019? networking, sponsored events, etc..
/r/Python
https://redd.it/befojw
reddit
r/Python - cool events during pycon?
6 votes and 1 comment so far on Reddit
Celery and flower (more questions! :))
Hey everyone,
​
I've been reading and struggling a bit more to get some extra stuff going and thought it's time to ask again.
​
I've set up flower to monitor celery and I'm seeing two really weird things.
​
the first is that I can see tasks that are active, etc in my dashboard, but my tasks, broker and monitor panels are empty.
​
you can see it here:
​
https://i.redd.it/tqcwl1dpovs21.png
https://i.redd.it/u9h7wdapovs21.png
https://i.redd.it/dvwbl2bpovs21.png
https://i.redd.it/0bcgloapovs21.png
I've got celery and flower managed by supervisord, so their started like this:
​
`[program:myproject]`
`command=sudo /etc/init.d/celeryd start`
`directory=/home/ian/myproject`
​
`stdout_logfile=/var/log/celeryd/celerydstdout.log`
`stderr_logfile=/var/log/celeryd/celerydstderr.log`
`user=***`
`password=*****`
`autostart=true`
`autorestart=true`
`startsecs=10`
`stopwaitsecs=600`
​
`[program:flower]`
`directory=/home/ian/myproject`
`command =flower -A myproject --broker_api=http://localhost:15672/api --broker=pyamqp://`
`stdout_logfile=/var/log/flower/flowerstdout.log`
`stderr_logfile=/var/log/flower/flowerstderr.log`
`autostart=true`
`autorestart=true`
​
Also I'm no sure whether I should manage celery with supervisord, It seems that the script in init.d starts and manages itself?
​
I never seem to get supervisor to start and monitor it, i.e. supervisorctl returns this
​
`supervisorctl status`
`flower RUNNING pid 16741, uptime 1 day, 8:39:08`
`myproject FATAL Exited too quickly (process log may h`
​
The second issue I'm seeing is that retries seem to occur but just dissapear. If I look at the task panel again:
​
​
https://i.redd.it/iqwtm11opvs21.png
It shows the amount of tasks processed,succeeded and retried. The amount of tasks retried never seem to move to succeeded or failed.
​
I looked at the log files of my celery workers and I can see the task gets accepted, retried and then just disappears. This is the
/r/flask
https://redd.it/bec9s9
Hey everyone,
​
I've been reading and struggling a bit more to get some extra stuff going and thought it's time to ask again.
​
I've set up flower to monitor celery and I'm seeing two really weird things.
​
the first is that I can see tasks that are active, etc in my dashboard, but my tasks, broker and monitor panels are empty.
​
you can see it here:
​
https://i.redd.it/tqcwl1dpovs21.png
https://i.redd.it/u9h7wdapovs21.png
https://i.redd.it/dvwbl2bpovs21.png
https://i.redd.it/0bcgloapovs21.png
I've got celery and flower managed by supervisord, so their started like this:
​
`[program:myproject]`
`command=sudo /etc/init.d/celeryd start`
`directory=/home/ian/myproject`
​
`stdout_logfile=/var/log/celeryd/celerydstdout.log`
`stderr_logfile=/var/log/celeryd/celerydstderr.log`
`user=***`
`password=*****`
`autostart=true`
`autorestart=true`
`startsecs=10`
`stopwaitsecs=600`
​
`[program:flower]`
`directory=/home/ian/myproject`
`command =flower -A myproject --broker_api=http://localhost:15672/api --broker=pyamqp://`
`stdout_logfile=/var/log/flower/flowerstdout.log`
`stderr_logfile=/var/log/flower/flowerstderr.log`
`autostart=true`
`autorestart=true`
​
Also I'm no sure whether I should manage celery with supervisord, It seems that the script in init.d starts and manages itself?
​
I never seem to get supervisor to start and monitor it, i.e. supervisorctl returns this
​
`supervisorctl status`
`flower RUNNING pid 16741, uptime 1 day, 8:39:08`
`myproject FATAL Exited too quickly (process log may h`
​
The second issue I'm seeing is that retries seem to occur but just dissapear. If I look at the task panel again:
​
​
https://i.redd.it/iqwtm11opvs21.png
It shows the amount of tasks processed,succeeded and retried. The amount of tasks retried never seem to move to succeeded or failed.
​
I looked at the log files of my celery workers and I can see the task gets accepted, retried and then just disappears. This is the
/r/flask
https://redd.it/bec9s9
Django tutorial videos by Nigel George, author of "Mastering Django"
https://www.youtube.com/channel/UCiuZer2ELlG3dAhWCzwz9Og/videos
/r/django
https://redd.it/beih8j
https://www.youtube.com/channel/UCiuZer2ELlG3dAhWCzwz9Og/videos
/r/django
https://redd.it/beih8j
YouTube
djangotutorials
Python script + Azure ad sso
Hey everyone,
I browsed the sub, stackoverflow and whatever I saw related but with no luck, so its time for a post.
I'm trying to work on a webscrapper that gets some static data from a few URLS, however to access them you first need your microsoft authentication done which is shared for all the pages..
Overall its simple up un till you get to the authentication step... problem comes that the accounts that would use this have MFA attached which sends push notifications, doing it with a simple user+pass account seemed easy, but thats not what I need sadly... I looked over the azure documentation, adal library and all sorts of solutions but I could not find a way to even trigger the push notification on my phone..
Only way i've gotten it to work is to use selenium to simulate the user access, but thats not what I want generally speaking.. Anyone has any tips to share with me? :)
​
Thanks
/r/Python
https://redd.it/bejqy6
Hey everyone,
I browsed the sub, stackoverflow and whatever I saw related but with no luck, so its time for a post.
I'm trying to work on a webscrapper that gets some static data from a few URLS, however to access them you first need your microsoft authentication done which is shared for all the pages..
Overall its simple up un till you get to the authentication step... problem comes that the accounts that would use this have MFA attached which sends push notifications, doing it with a simple user+pass account seemed easy, but thats not what I need sadly... I looked over the azure documentation, adal library and all sorts of solutions but I could not find a way to even trigger the push notification on my phone..
Only way i've gotten it to work is to use selenium to simulate the user access, but thats not what I want generally speaking.. Anyone has any tips to share with me? :)
​
Thanks
/r/Python
https://redd.it/bejqy6
reddit
r/Python - Python script + Azure ad sso
0 votes and 0 comments so far on Reddit
Summing squares of 32M doubles performance: Python vs C++ vs Node.js
https://twitter.com/dimitrovskif/status/1118810876084092928
/r/Python
https://redd.it/bejttw
https://twitter.com/dimitrovskif/status/1118810876084092928
/r/Python
https://redd.it/bejttw
Twitter
Filip Dimitrovski
By also adding fastmath=True to numba I got to 25ms. I don't think it can get any better without intervening with the LLVM generation. Table w/ all cases:
Packaging Python inside your organization with GitLab and Conda
https://stefan.sofa-rockers.org/2019/04/18/python-packaging-gitlab-conda/
/r/Python
https://redd.it/bekm8c
https://stefan.sofa-rockers.org/2019/04/18/python-packaging-gitlab-conda/
/r/Python
https://redd.it/bekm8c
reddit
r/Python - Packaging Python inside your organization with GitLab and Conda
0 votes and 1 comment so far on Reddit
Python programmers, what's a regular day in your job like?
Like the title says: I'm not a python programmer myself, I'm a motion designer who learned (and learned to love) using python, and I'm considering a change of carrier. However I know that doing something you like as a job is much different than doing it as a hobby, hence my question: what's it like to be a python professional?
/r/Python
https://redd.it/belx64
Like the title says: I'm not a python programmer myself, I'm a motion designer who learned (and learned to love) using python, and I'm considering a change of carrier. However I know that doing something you like as a job is much different than doing it as a hobby, hence my question: what's it like to be a python professional?
/r/Python
https://redd.it/belx64
reddit
r/Python - Python programmers, what's a regular day in your job like?
0 votes and 3 comments so far on Reddit
[AF] Anyone know how to use WTForms MultipleFileField?
There's no documentation other than "it works like FielField but for multiple files". Does anyone have an example for how to access raw data from the multiple uploaded files?
/r/flask
https://redd.it/beagm2
There's no documentation other than "it works like FielField but for multiple files". Does anyone have an example for how to access raw data from the multiple uploaded files?
/r/flask
https://redd.it/beagm2
reddit
r/flask - [AF] Anyone know how to use WTForms MultipleFileField?
10 votes and 3 comments so far on Reddit
Keeping track of what rating each User gave to each Movie, where Users and Movies can be added at any time?
What field will do this job? A onetoone field? Manytoone? Manytomany?
Basically, let's say I'm building a site where users rate movies. Each user gives each movie a rating (or lack thereof) and different users can have different rating for each movie. New users are joining all the time. New movies are also being added all the time.
The default rating for all his/her movies when a new user joins is "None". The default rating from all users when a new movie is added is also "None".
I also want to quickly look up what the average rating a particular movie has gotten across all users that rated it. And similarly, look up the average rating a user has given for all movies he/she rated.
(Ok, I'm actually not building a movie rating app but that's the closest example I can think of to describe this type of data structure that I have no idea what to call and hence cannot rely on Google for answers, hence that's why I'm asking here.)
/r/djangolearning
https://redd.it/begpts
What field will do this job? A onetoone field? Manytoone? Manytomany?
Basically, let's say I'm building a site where users rate movies. Each user gives each movie a rating (or lack thereof) and different users can have different rating for each movie. New users are joining all the time. New movies are also being added all the time.
The default rating for all his/her movies when a new user joins is "None". The default rating from all users when a new movie is added is also "None".
I also want to quickly look up what the average rating a particular movie has gotten across all users that rated it. And similarly, look up the average rating a user has given for all movies he/she rated.
(Ok, I'm actually not building a movie rating app but that's the closest example I can think of to describe this type of data structure that I have no idea what to call and hence cannot rely on Google for answers, hence that's why I'm asking here.)
/r/djangolearning
https://redd.it/begpts
reddit
r/djangolearning - Keeping track of what rating each User gave to each Movie, where Users and Movies can be added at any time?
2 votes and 3 comments so far on Reddit
Pyodide: Bringing the scientific Python stack to the browser – Mozilla Hacks - the Web developer blog
https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scientific-python-stack-to-the-browser/
/r/Python
https://redd.it/bengir
https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scientific-python-stack-to-the-browser/
/r/Python
https://redd.it/bengir
Mozilla Hacks – the Web developer blog
Pyodide: Bringing the scientific Python stack to the browser
Pyodide is an experimental project from Mozilla to create a full Python data science stack that runs entirely in the browser. We think it’s worthwhile to work on moving the ...
Django Admin - Hide For Unauthorized People
Hi. I created a Django webserver which will go online soon. I want to raise a 404 on the admin page when the user is not logged in. I have my own login-service and only admins should be able to access the admin page.
I mean this:
**Normal User, Logged out:**
\-> 404
**Normal User, Logged in:**
\-> 404
**Admin User, Logged out:**
\-> 404
**Admin User, Logged in:**
\-> Access
​
Do you have any idea how to do this?
Thanks.
/r/django
https://redd.it/bepmlt
Hi. I created a Django webserver which will go online soon. I want to raise a 404 on the admin page when the user is not logged in. I have my own login-service and only admins should be able to access the admin page.
I mean this:
**Normal User, Logged out:**
\-> 404
**Normal User, Logged in:**
\-> 404
**Admin User, Logged out:**
\-> 404
**Admin User, Logged in:**
\-> Access
​
Do you have any idea how to do this?
Thanks.
/r/django
https://redd.it/bepmlt
reddit
r/django - Django Admin - Hide For Unauthorized People
0 votes and 3 comments so far on Reddit