Glowscript in JupyterLab
I believe I read that currently there are no plans to have JavaScript implemented in JupyterLab. This would mean that Glowscript would no longer be supported. Am I reading this wrong, or are glowscript’s days numbered with Jupiter? Or perhaps Jupyter notebooks will be around for the foreseeable future? I think many physics educators would be interested in knowing if glowscript will still be supported.
/r/IPython
https://redd.it/8hgavu
I believe I read that currently there are no plans to have JavaScript implemented in JupyterLab. This would mean that Glowscript would no longer be supported. Am I reading this wrong, or are glowscript’s days numbered with Jupiter? Or perhaps Jupyter notebooks will be around for the foreseeable future? I think many physics educators would be interested in knowing if glowscript will still be supported.
/r/IPython
https://redd.it/8hgavu
reddit
r/IPython - Glowscript in JupyterLab
2 votes and 1 so far on reddit
Pyception - Nerdy parody for Inception ( Love the creativity )
https://www.youtube.com/watch?v=UXd0EDy7aTY
/r/Python
https://redd.it/8hodmx
https://www.youtube.com/watch?v=UXd0EDy7aTY
/r/Python
https://redd.it/8hodmx
YouTube
2018 AnacondaCON
Pyception
[AF] It's 2018 - how do you document your REST APIs in Flask?
Hey everyone, I'm currently using Flask as a RESTful API endpoint using Flask-RESTful. At the moment I'm just writing the API without any sort of documentation at all. I have no idea where to turn to learn about building documentation for my APIs, or if Flask-RESTful is still even the consensus king for setting up REST endpoints in Flask. Most documentation I can find on this subject is years old.
So my question: it's 2018 - what is everyone using for RESTful API endpoints + documentation in Flask?
/r/flask
https://redd.it/8hqj5r
Hey everyone, I'm currently using Flask as a RESTful API endpoint using Flask-RESTful. At the moment I'm just writing the API without any sort of documentation at all. I have no idea where to turn to learn about building documentation for my APIs, or if Flask-RESTful is still even the consensus king for setting up REST endpoints in Flask. Most documentation I can find on this subject is years old.
So my question: it's 2018 - what is everyone using for RESTful API endpoints + documentation in Flask?
/r/flask
https://redd.it/8hqj5r
reddit
[AF] It's 2018 - how do you document your REST APIs in... • r/flask
Hey everyone, I'm currently using Flask as a RESTful API endpoint using Flask-RESTful. At the moment I'm just writing the API without any sort of...
Keeping data integrity with Django migrations
https://cheesecakelabs.com/br/blog/keeping-data-integrity-django-migrations/
/r/django
https://redd.it/8hqa4k
https://cheesecakelabs.com/br/blog/keeping-data-integrity-django-migrations/
/r/django
https://redd.it/8hqa4k
Cheesecake Labs
Keeping data integrity with Django migrations | Cheesecake Labs
Django built-in migrations were designed as a way of propagating the changes you make on the models to the database. Migrations exist mostly to keep your code in sync with your schema and to provide a good way of versioning it. We just need a couple of commands…
Running a python script together with django - best practice question
Hi, this is very tangential to regular python programming, but maybe you guys have encountered the same problem!
I'm building a web-app that needs support from a script, or other application running on the server. The function of the script is to match entries from an order model.
Short-code: matcher.py
from app.models import item1model, item2model, madematchmodel
import time
While True:
item1=item1model.objects.get(identifier='id')
item2=item2model.objects.get(identifier='id')
if match:
match=madematchmodel(item1=item1, item2=item2)
match.save()
else:
pass
time.sleep(5)
As you might notice I'm a novice at both django and programming in general, am I breaking any major rules by having a constantly running While True:-script here?
What is a better way to accomplish this?
/r/django
https://redd.it/8hr5jz
Hi, this is very tangential to regular python programming, but maybe you guys have encountered the same problem!
I'm building a web-app that needs support from a script, or other application running on the server. The function of the script is to match entries from an order model.
Short-code: matcher.py
from app.models import item1model, item2model, madematchmodel
import time
While True:
item1=item1model.objects.get(identifier='id')
item2=item2model.objects.get(identifier='id')
if match:
match=madematchmodel(item1=item1, item2=item2)
match.save()
else:
pass
time.sleep(5)
As you might notice I'm a novice at both django and programming in general, am I breaking any major rules by having a constantly running While True:-script here?
What is a better way to accomplish this?
/r/django
https://redd.it/8hr5jz
reddit
r/django - Running a python script together with django - best practice question
1 votes and 3 so far on reddit
Where is Django's under the hood stuff located?
Watching the command line drift by I notice references to files that aren't in y project files, and when I get errors also. I am wondering where these files are? I' just curious as to how things work under the hood.
/r/djangolearning
https://redd.it/8hppvf
Watching the command line drift by I notice references to files that aren't in y project files, and when I get errors also. I am wondering where these files are? I' just curious as to how things work under the hood.
/r/djangolearning
https://redd.it/8hppvf
reddit
r/djangolearning - Where is Django's under the hood stuff located?
5 votes and 3 so far on reddit
Raspberry Pi, Camera Motion detection. Security surveillance for your room.
https://github.com/WillPhillipsCVdemo/Raspberry-Pi-Camera-Motion-Detection./blob/master/PIR_Motion_Camera_Email.py
/r/Python
https://redd.it/8hrfyy
https://github.com/WillPhillipsCVdemo/Raspberry-Pi-Camera-Motion-Detection./blob/master/PIR_Motion_Camera_Email.py
/r/Python
https://redd.it/8hrfyy
GitHub
Raspberry-Pi-Camera-Motion-Detection./PIR_Motion_Camera_Email.py at master · WillPhillipsCVdemo/Raspberry-Pi-Camera-Motion-Detection.
Using Python code with a Raspberry-Pi, PIR motion and a Picamera, you can create a device which will email you a snapshot image when someone enters your room. - Raspberry-Pi-Camera-Motion-Detection...
Mobile App Creation
I'm wondering, would the following be a viable strategy for a mobile application? use Python Kivy cross\-platform for front\-end; some sort of Distributed D.B like NoSQL with Python queries for Backend; and REST or SOCKET or some sort of messaging\-bus for Front\-end to back\-end interactions?
/r/Python
https://redd.it/8hsn8k
I'm wondering, would the following be a viable strategy for a mobile application? use Python Kivy cross\-platform for front\-end; some sort of Distributed D.B like NoSQL with Python queries for Backend; and REST or SOCKET or some sort of messaging\-bus for Front\-end to back\-end interactions?
/r/Python
https://redd.it/8hsn8k
reddit
Mobile App Creation • r/Python
I'm wondering, would the following be a viable strategy for a mobile application? use Python Kivy cross\-platform for front\-end; some sort of...
[AF]ForeignKey is always OFF and not working between tables in SQLalchemy in Flask
My code for db in Flask and SQLalchemy is working but when I make comment in post, ForeignKey doesn't link comment with that post and there is no value for post_id in table "comment" when comment is created.
Do you please know, what could be wrong? Tryed using Pragma to force foreignkey, but it didnt help. Tried to enforce ForeignKey ON with sqlite> PRAGMA foreign_keys = ON; but it does not persist.
Thank you
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///userdata.db'
db = SQLAlchemy(app)
engine = create_engine('sqlite:///userdata.db')
def _fk_pragma_on_connect(dbapi_con, con_record):
dbapi_con.execute('pragma foreign_keys=ON')
from sqlalchemy import event
event.listen(engine, 'connect', _fk_pragma_on_connect)
class Post(db.Model):
__tablename__ = 'post'
id = db.Column(Integer, primary_key=True)
title = db.Column(String(50))
subtitle = db.Column(String(50))
author = db.Column(String(20))
date_posted = db.Column(DateTime)
content = db.Column(Text)
post_rel = relationship('Comment',
back_populates='comment_rel',
foreign_keys='[Comment.post_id]')
def get_comments(self):
return Comments.query.filter_by(
post_id=post.id).order_by(Comments.timestamp.desc())
def __repr__(self):
return '<Post %r>' % (self.body)
class Comment(db.Model):
__tablename__ = 'comment'
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.String(140))
author = db.Column(db.String(32))
timestamp = db.Column(db.DateTime(), default=datetime.utcnow, index=True)
post_id = db.Column(db.Integer, db.ForeignKey('post.id'), nullable=False)
comment_rel = relationship('Post', uselist=False, back_populates='post_rel')
def __init__(self, text, author, timestamp):
""""""
self.text = text
self.author = author
self.timestamp = timestamp
def __repr__(self):
return '<Post %r>' % (self.body)
def show(self):
return self.author + '\n' + self.text
@app.route('/addcomment', methods=['POST'])
def addcomment():
commentar = request.form['commentar']
comment_done = Comment(text=commentar, author=current_user.username,
timestamp=datetime.now())
db.session.add(comment_done, 'PRAGMA foreign_keys=on')
db.session.commit()
return render_template('post.html', post=post)
/r/flask
https://redd.it/8hn1vs
My code for db in Flask and SQLalchemy is working but when I make comment in post, ForeignKey doesn't link comment with that post and there is no value for post_id in table "comment" when comment is created.
Do you please know, what could be wrong? Tryed using Pragma to force foreignkey, but it didnt help. Tried to enforce ForeignKey ON with sqlite> PRAGMA foreign_keys = ON; but it does not persist.
Thank you
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///userdata.db'
db = SQLAlchemy(app)
engine = create_engine('sqlite:///userdata.db')
def _fk_pragma_on_connect(dbapi_con, con_record):
dbapi_con.execute('pragma foreign_keys=ON')
from sqlalchemy import event
event.listen(engine, 'connect', _fk_pragma_on_connect)
class Post(db.Model):
__tablename__ = 'post'
id = db.Column(Integer, primary_key=True)
title = db.Column(String(50))
subtitle = db.Column(String(50))
author = db.Column(String(20))
date_posted = db.Column(DateTime)
content = db.Column(Text)
post_rel = relationship('Comment',
back_populates='comment_rel',
foreign_keys='[Comment.post_id]')
def get_comments(self):
return Comments.query.filter_by(
post_id=post.id).order_by(Comments.timestamp.desc())
def __repr__(self):
return '<Post %r>' % (self.body)
class Comment(db.Model):
__tablename__ = 'comment'
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.String(140))
author = db.Column(db.String(32))
timestamp = db.Column(db.DateTime(), default=datetime.utcnow, index=True)
post_id = db.Column(db.Integer, db.ForeignKey('post.id'), nullable=False)
comment_rel = relationship('Post', uselist=False, back_populates='post_rel')
def __init__(self, text, author, timestamp):
""""""
self.text = text
self.author = author
self.timestamp = timestamp
def __repr__(self):
return '<Post %r>' % (self.body)
def show(self):
return self.author + '\n' + self.text
@app.route('/addcomment', methods=['POST'])
def addcomment():
commentar = request.form['commentar']
comment_done = Comment(text=commentar, author=current_user.username,
timestamp=datetime.now())
db.session.add(comment_done, 'PRAGMA foreign_keys=on')
db.session.commit()
return render_template('post.html', post=post)
/r/flask
https://redd.it/8hn1vs
reddit
r/flask - [AF]ForeignKey is always OFF and not working between tables in SQLalchemy in Flask
3 votes and 5 so far on reddit
Helping LibreOffice in Python
People post here periodically looking for projects to work on to better their skills. I can recommend helping out LibreOffice: https://wiki.documentfoundation.org/Macros/Python_Design_Guide
Most of the work in LibreOffice is in C++. It ships with a Python interpreter, and has some scripts for QA, and Wizards, and a simple grammar checker, but there's not much going on currently: https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=python
If people who want to improve their Python skills also want to help a production codebase, it's a good place to go. LibreOffice is important to the free desktop, and the work could get used by many people.
They also have a few Easy Hacks as a way to start: https://wiki.documentfoundation.org/Development/EasyHacks/by_Required_Skill/Skill_Python
I did some C++ patches to make it look good on HiDPI screens. I'd post a link but the development process is so different between Python and C++ that it wouldn't be useful ;-)
LibreOffice is missing even basic plugins to Wikipedia and WikiCommons and the CC Flickr, smart grammar checkers, etc. There are many ways to make LibreOffice better via little Python plugins. Here's the grammar checker which gives a sample: https://cgit.freedesktop.org/libreoffice/lightproof/tree/
/r/Python
https://redd.it/8htykb
People post here periodically looking for projects to work on to better their skills. I can recommend helping out LibreOffice: https://wiki.documentfoundation.org/Macros/Python_Design_Guide
Most of the work in LibreOffice is in C++. It ships with a Python interpreter, and has some scripts for QA, and Wizards, and a simple grammar checker, but there's not much going on currently: https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=python
If people who want to improve their Python skills also want to help a production codebase, it's a good place to go. LibreOffice is important to the free desktop, and the work could get used by many people.
They also have a few Easy Hacks as a way to start: https://wiki.documentfoundation.org/Development/EasyHacks/by_Required_Skill/Skill_Python
I did some C++ patches to make it look good on HiDPI screens. I'd post a link but the development process is so different between Python and C++ that it wouldn't be useful ;-)
LibreOffice is missing even basic plugins to Wikipedia and WikiCommons and the CC Flickr, smart grammar checkers, etc. There are many ways to make LibreOffice better via little Python plugins. Here's the grammar checker which gives a sample: https://cgit.freedesktop.org/libreoffice/lightproof/tree/
/r/Python
https://redd.it/8htykb
Poetry (Dependency management for Python) 0.9.0 is out: huge dependency resolution speed improvements and more
https://poetry.eustace.io/blog/poetry-0-9-0-is-out.html
/r/Python
https://redd.it/8hp9re
https://poetry.eustace.io/blog/poetry-0-9-0-is-out.html
/r/Python
https://redd.it/8hp9re
poetry.eustace.io
Poetry 0.9.0 is out | Blog | Poetry - Python dependency management and packaging made easy.
This version brings huge improvements to the dependency resolution speed.
Radioselect widget for forms.BooleanField creates a 3th, empty value option besides of True/False. how do I remove that option?
I've followed https://stackoverflow.com/a/3961084 to set a booleanfield to display 2 radio buttons with custom text for the True/False values, but it creates a 3th option , labeled "-----".
this button has a blank value. Looking at the POST values, selecting it does set`'add'(the booleanfield) to ['']`and gives a `ValidationError at (an url) ["'' value must be either True or False."]` How do I remove it?
Never mind, found it at the django docs.
If the model field has choices set, then the form field’s widget will be set to Select, with choices coming from the
model field’s choices. The choices will normally include the blank choice which is selected by default. If the field is
required, this forces the user to make a selection. The blank choice will not be included if the model field has
blank=False and an explicit default value (the default value will be initially selected instead).
/r/djangolearning
https://redd.it/8hudfw
I've followed https://stackoverflow.com/a/3961084 to set a booleanfield to display 2 radio buttons with custom text for the True/False values, but it creates a 3th option , labeled "-----".
this button has a blank value. Looking at the POST values, selecting it does set`'add'(the booleanfield) to ['']`and gives a `ValidationError at (an url) ["'' value must be either True or False."]` How do I remove it?
Never mind, found it at the django docs.
If the model field has choices set, then the form field’s widget will be set to Select, with choices coming from the
model field’s choices. The choices will normally include the blank choice which is selected by default. If the field is
required, this forces the user to make a selection. The blank choice will not be included if the model field has
blank=False and an explicit default value (the default value will be initially selected instead).
/r/djangolearning
https://redd.it/8hudfw
Stack Overflow
Django BooleanField as radio buttons?
Is there a widget in Django 1.0.2 to render a models.BooleanField as two radio buttons instead of a checkbox?
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/8hwz4o
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/8hwz4o
reddit
r/Python - What's everyone working on this week?
1 votes and 1 so far on reddit
Backdoor in ssh-decorator package
Do not install or use the [ssh\-decorator](https://pypi.org/project/ssh-decorate/#files) package from Pip. It has a backdoor inserted to steal all your SSH credentials. I've already contacted the developer to take it out. He hasn't responded so for now, use at your own risk! [https://ibb.co/kdDk67](https://www.linkedin.com/redir/redirect?url=https%3A%2F%2Fibb%2Eco%2FkdDk67&urlhash=SFzn&_t=tracking_anet)
**UPDATE:** The compromised package has been taken down now.
https://i.redd.it/zu0guck3cmw01.png
/r/Python
https://redd.it/8hvzja
Do not install or use the [ssh\-decorator](https://pypi.org/project/ssh-decorate/#files) package from Pip. It has a backdoor inserted to steal all your SSH credentials. I've already contacted the developer to take it out. He hasn't responded so for now, use at your own risk! [https://ibb.co/kdDk67](https://www.linkedin.com/redir/redirect?url=https%3A%2F%2Fibb%2Eco%2FkdDk67&urlhash=SFzn&_t=tracking_anet)
**UPDATE:** The compromised package has been taken down now.
https://i.redd.it/zu0guck3cmw01.png
/r/Python
https://redd.it/8hvzja
PyPI
ssh-decorate
Run python code via ssh with a decorator
Django rest and React
So i just started with django rest and front end frameworks e.g react. From what I've seen with react is that we fetch data from a rest api. We only get data and we build all our logic as to what to do with that data in react.
So here's my question: I've built apps with django before. I've had to create views, forms signals etc etc. however will this be the same case when I want to make a single page application using the rest api? I mean in this case my django application will only serve the function of providing an api right? it will not have anything to do with views and forms logic? all of that will be done in react ?
Basically my question is this: If i want to make a single page application. Do I only need django to serve as a data storage which will provide an api and build all the logic and stuff in the front end e.g angular, react or vue etc?
/r/django
https://redd.it/8hv7ye
So i just started with django rest and front end frameworks e.g react. From what I've seen with react is that we fetch data from a rest api. We only get data and we build all our logic as to what to do with that data in react.
So here's my question: I've built apps with django before. I've had to create views, forms signals etc etc. however will this be the same case when I want to make a single page application using the rest api? I mean in this case my django application will only serve the function of providing an api right? it will not have anything to do with views and forms logic? all of that will be done in react ?
Basically my question is this: If i want to make a single page application. Do I only need django to serve as a data storage which will provide an api and build all the logic and stuff in the front end e.g angular, react or vue etc?
/r/django
https://redd.it/8hv7ye
reddit
Django rest and React • r/django
So i just started with django rest and front end frameworks e.g react. From what I've seen with react is that we fetch data from a rest api. We...
Build a full-featured web application using Flask
http://www.youtube.com/watch?v=MwZwr5Tvyxo&list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH
/r/Python
https://redd.it/8hye3u
http://www.youtube.com/watch?v=MwZwr5Tvyxo&list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH
/r/Python
https://redd.it/8hye3u
YouTube
Python Flask Tutorial: Full-Featured Web App Part 1 - Getting Started
In this Python Flask Tutorial, we will be learning how to get started using the Flask framework. We will install the necessary packages and get a basic Hello World Application running in our browser. Let's get started...
The code for this series can be found…
The code for this series can be found…
Multiple apps, same login.
I am currently running a flask app under `mysite.com`. Now I would like to add a second flask app that will run under a subdomain, say `new.mysite.com`.
What I would like to do is have the main app handle the user authentication so if you login in `mysite.com/login` you are good for `new.mysite.com` too. Right now I am using the flask-login plugin for the main site. Ideally I don't want to add any authentication code or deal with the user database in the second app, but my understanding is that I still need a login manager and a user loader.
What is the proper way to implement this?
/r/flask
https://redd.it/8ggd5r
I am currently running a flask app under `mysite.com`. Now I would like to add a second flask app that will run under a subdomain, say `new.mysite.com`.
What I would like to do is have the main app handle the user authentication so if you login in `mysite.com/login` you are good for `new.mysite.com` too. Right now I am using the flask-login plugin for the main site. Ideally I don't want to add any authentication code or deal with the user database in the second app, but my understanding is that I still need a login manager and a user loader.
What is the proper way to implement this?
/r/flask
https://redd.it/8ggd5r
Email authentication
I'm on a subject of creating/authenticating accounts. Now when a user signs up, I want them to use a valid email. (Gmail, Yahoo etc.) And not fake one time use emails. Whats the best way going about doing this? I've been looking at creating a list of valid email address endings
ie. Endswith @gmail.com, @yahoo.com.
If it matches those it would be valid. I'm not sure if there is a better way...Thoughts?
/r/djangolearning
https://redd.it/8hytlv
I'm on a subject of creating/authenticating accounts. Now when a user signs up, I want them to use a valid email. (Gmail, Yahoo etc.) And not fake one time use emails. Whats the best way going about doing this? I've been looking at creating a list of valid email address endings
ie. Endswith @gmail.com, @yahoo.com.
If it matches those it would be valid. I'm not sure if there is a better way...Thoughts?
/r/djangolearning
https://redd.it/8hytlv
reddit
Email authentication • r/djangolearning
I'm on a subject of creating/authenticating accounts. Now when a user signs up, I want them to use a valid email. (Gmail, Yahoo etc.) And not...