Update datapoint in Postgress
Hi! I'm new to flask and Postgres. I want to update a column based on user input. Should I create a separate get and post methods or use my existing ones?
​
I want to update the count of an existing entry.
​
@app.route('/')
def get_exams():
# fetching from the database
session = Session()
exam_objects = session.query(Exam).all()
# transforming into JSON-serializable objects
schema = ExamSchema(many=True)
exams = schema.dump(exam_objects)
# serializing as JSON
session.close()
return jsonify(exams.data)
@app.route('/', methods=['POST'])
def add_exam():
# mount exam object
posted_exam = ExamSchema(only=('title', 'description', 'count'))\
.load(request.get_json())
exam = Exam(**posted_exam.data, created_by="HTTP post request")
# persist exam
session = Session()
session.add(exam)
session.commit()
# return created exam
new_exam = ExamSchema().dump(exam).data
session.close()
return jsonify(new_exam), 201
​
/r/flask
https://redd.it/axgl8j
Hi! I'm new to flask and Postgres. I want to update a column based on user input. Should I create a separate get and post methods or use my existing ones?
​
I want to update the count of an existing entry.
​
@app.route('/')
def get_exams():
# fetching from the database
session = Session()
exam_objects = session.query(Exam).all()
# transforming into JSON-serializable objects
schema = ExamSchema(many=True)
exams = schema.dump(exam_objects)
# serializing as JSON
session.close()
return jsonify(exams.data)
@app.route('/', methods=['POST'])
def add_exam():
# mount exam object
posted_exam = ExamSchema(only=('title', 'description', 'count'))\
.load(request.get_json())
exam = Exam(**posted_exam.data, created_by="HTTP post request")
# persist exam
session = Session()
session.add(exam)
session.commit()
# return created exam
new_exam = ExamSchema().dump(exam).data
session.close()
return jsonify(new_exam), 201
​
/r/flask
https://redd.it/axgl8j
reddit
r/flask - Update datapoint in Postgress
0 votes and 0 comments so far on Reddit
I've just published the second episode of my mini series "How To Build a Text Editor with Python and TkInter"
https://youtu.be/-GLaHb-s4kA
/r/Python
https://redd.it/ax939x
https://youtu.be/-GLaHb-s4kA
/r/Python
https://redd.it/ax939x
YouTube
How To Build a Text Editor with PYTHON and TKINTER - (Part 2 of 3)
►Do You Want More Videos about Python, Web Development and Programming?
►Subscribe NOW: https://www.youtube.com/channel/UCxPWtz5N--X3IyYJ13Zr99A?sub_confirmation=1
-----------------------------------------------------------------------------
First Episode:…
►Subscribe NOW: https://www.youtube.com/channel/UCxPWtz5N--X3IyYJ13Zr99A?sub_confirmation=1
-----------------------------------------------------------------------------
First Episode:…
[P] Ever wondered how to use your trained sklearn/xgboost/lightgbm models in production? We developed a simple library which turns your models into native code (Python/C/Java)
Imagine that you trained your super accurate model using your favorite tools (Python/sklearn/xgboost/etc.) and now the time has come to deploy your model to production for the greater good.
But consider the following scenarios:
* What if your production environment has no Python runtime?
* What if your model should make instantaneous predictions right on a microcontroller device without sending data to a remote server?
* What if prediction speed is a concern too?
This where m2cgen comes in handy. It's a library that generates Java/Python/C code from trained ML models.
Check it out: https://github.com/BayesWitnesses/m2cgen/
/r/MachineLearning
https://redd.it/axdirb
Imagine that you trained your super accurate model using your favorite tools (Python/sklearn/xgboost/etc.) and now the time has come to deploy your model to production for the greater good.
But consider the following scenarios:
* What if your production environment has no Python runtime?
* What if your model should make instantaneous predictions right on a microcontroller device without sending data to a remote server?
* What if prediction speed is a concern too?
This where m2cgen comes in handy. It's a library that generates Java/Python/C code from trained ML models.
Check it out: https://github.com/BayesWitnesses/m2cgen/
/r/MachineLearning
https://redd.it/axdirb
GitHub
GitHub - BayesWitnesses/m2cgen: Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell…
Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell, PHP, Dart, Haskell, Ruby, F#, Rust) with zero dependencies - BayesWitnesses/m2cgen
[AF] sqlalchemy password authetication failed for user "USERNAME". Confused as to what password is being used here.
Hi, so I am trying to get the backend for my website running using postgres alongside Flask. I have the following URI:
"postgresql://username:password@localhost/websitename"
So the problem being presented to me is the password. Do I have to input my actual linux system password into the password field or the postgresql password. I'm sure it's the latter however if that were the case I'd then need to find out how to gain access to this password as I do not remember setting one. Any help is greatly appreciated.
/r/flask
https://redd.it/aximdk
Hi, so I am trying to get the backend for my website running using postgres alongside Flask. I have the following URI:
"postgresql://username:password@localhost/websitename"
So the problem being presented to me is the password. Do I have to input my actual linux system password into the password field or the postgresql password. I'm sure it's the latter however if that were the case I'd then need to find out how to gain access to this password as I do not remember setting one. Any help is greatly appreciated.
/r/flask
https://redd.it/aximdk
reddit
r/flask - [AF] sqlalchemy password authetication failed for user "USERNAME". Confused as to what password is being used here.
1 vote and 1 comment so far on Reddit
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/axljrp
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/axljrp
reddit
r/Python - What's everyone working on this week?
0 votes and 0 comments so far on Reddit
Ordering by primary key
How do you order by a specific field, I used primary key as an example. I'm confused as to where this goes when using Classed Based Views. I have tried this but it's not doing what I expected:
from django.shortcuts import render, redirect
from django.template import RequestContext
from django.views.generic import View,TemplateView,ListView,DetailView
from . import models
class TestPageView(ListView):
context_object_name = 'categories'
model = models.Category
template_name='category_list.html'
ordering = ['id']
When first learning, using function based views it was easy to just add .order\_by, but not sure where to put this in CBVs.
​
/r/djangolearning
https://redd.it/axmvco
How do you order by a specific field, I used primary key as an example. I'm confused as to where this goes when using Classed Based Views. I have tried this but it's not doing what I expected:
from django.shortcuts import render, redirect
from django.template import RequestContext
from django.views.generic import View,TemplateView,ListView,DetailView
from . import models
class TestPageView(ListView):
context_object_name = 'categories'
model = models.Category
template_name='category_list.html'
ordering = ['id']
When first learning, using function based views it was easy to just add .order\_by, but not sure where to put this in CBVs.
​
/r/djangolearning
https://redd.it/axmvco
reddit
r/djangolearning - Ordering by primary key
2 votes and 3 comments so far on Reddit
Create a Dashboard using Highcharts and Django
https://www.highcharts.com/blog/post/create-a-dashboard-using-highcharts-and-django/
/r/django
https://redd.it/axlogs
https://www.highcharts.com/blog/post/create-a-dashboard-using-highcharts-and-django/
/r/django
https://redd.it/axlogs
Highcharts
Create a Dashboard using Highcharts and Django - Highcharts
Step by step tutorial to create interactive chart using Highcharts and Django.
Mind sharing an open source repo that showcases a well organized Django Rest Framework?
I've starting to dip my toes into building an API and find that looking over code can be helpful. Any direction here would be greatly appreciated.
/r/djangolearning
https://redd.it/axsa1m
I've starting to dip my toes into building an API and find that looking over code can be helpful. Any direction here would be greatly appreciated.
/r/djangolearning
https://redd.it/axsa1m
reddit
r/djangolearning - Mind sharing an open source repo that showcases a well organized Django Rest Framework?
11 votes and 0 comments so far on Reddit
Complete Web Application for Startup Written in Flask
Recently I created [Chronos](https://www.chronosevents.com/), a online meeting and event scheduling platform, written entirely in Python, powered by the Flask web framework. I created Chronos with the goal of reducing time wasted scheduling meetings, increasing teams’ scheduling coordination, and enabling meeting creators and team leaders to select optimal meeting times.
I created Chronos as an alternative to the large number of email chains I racked up while trying to schedule meetings with other members of project teams at my university, and since then, I have added a large number of features to streamline the overall meeting scheduling process. The minimal approach of Flask makes it much easier to focus on the actual design of the site and its features and is an extremely valuable part of the development.
I would appreciate any comments or feedback you may have!
/r/Python
https://redd.it/axm8y5
Recently I created [Chronos](https://www.chronosevents.com/), a online meeting and event scheduling platform, written entirely in Python, powered by the Flask web framework. I created Chronos with the goal of reducing time wasted scheduling meetings, increasing teams’ scheduling coordination, and enabling meeting creators and team leaders to select optimal meeting times.
I created Chronos as an alternative to the large number of email chains I racked up while trying to schedule meetings with other members of project teams at my university, and since then, I have added a large number of features to streamline the overall meeting scheduling process. The minimal approach of Flask makes it much easier to focus on the actual design of the site and its features and is an extremely valuable part of the development.
I would appreciate any comments or feedback you may have!
/r/Python
https://redd.it/axm8y5
Chronosevents
Group Meeting Scheduling | Chronos
Group meeting scheduling with timeslot selection, groups, and more. Create and finalize meetings with a with a few clicks and accurately select final times.
Anyone else find Web development boring due to CRUD
Recently I've been actively learning and developing a website for a family member in Flask. The website includes, login, gallery upload and delete, adding blog posts, email verification, and other stuff. With all this, my final part of the eCommerce store and I'm done.
​
But throughout this whole process I've been getting more and more bored due to the nature of everything seems repetitive. In my eyes all web development from my experience has been just CRUD, (create, read, update, delete).
Am I doing something wrong, or does anyone share the same experience?
/r/flask
https://redd.it/axob5v
Recently I've been actively learning and developing a website for a family member in Flask. The website includes, login, gallery upload and delete, adding blog posts, email verification, and other stuff. With all this, my final part of the eCommerce store and I'm done.
​
But throughout this whole process I've been getting more and more bored due to the nature of everything seems repetitive. In my eyes all web development from my experience has been just CRUD, (create, read, update, delete).
Am I doing something wrong, or does anyone share the same experience?
/r/flask
https://redd.it/axob5v
reddit
r/flask - Anyone else find Web development boring due to CRUD
18 votes and 17 comments so far on Reddit
Implementing a Neural Network from scratch in Python
https://victorzhou.com/blog/intro-to-neural-networks/
/r/Python
https://redd.it/axnvut
https://victorzhou.com/blog/intro-to-neural-networks/
/r/Python
https://redd.it/axnvut
Victorzhou
Machine Learning for Beginners: An Introduction to Neural Networks - victorzhou.com
A simple explanation of how they work and how to implement one from scratch in Python.
Web Development in Python with Django. 15 Videos ~ 4hours
https://www.youtube.com/playlist?list=PLhTjy8cBISEpXc-yjjSW90NgNyPYe7c9_
/r/Python
https://redd.it/axn7rv
https://www.youtube.com/playlist?list=PLhTjy8cBISEpXc-yjjSW90NgNyPYe7c9_
/r/Python
https://redd.it/axn7rv
Machine Learning Tutorial Part 1 | Machine Learning For Beginners
https://youtu.be/E3l_aeGjkeI
/r/Python
https://redd.it/axw8i3
https://youtu.be/E3l_aeGjkeI
/r/Python
https://redd.it/axw8i3
YouTube
Machine Learning Tutorial Part 1 | Machine Learning For Beginners
This Machine Learning tutorial will introduce you to the different areas of Machine Learning and Artificial Intelligence. In this part of the course you will learn about the three different learning types (Unsupervised learning, Supervised Learning and Reinforcement…
User login system in MongoDB using Flask?
The Flask Mega Tutorial that uses SQLite, MySQL or PostgreSQL (via Flask-SQLAlchemy) as backend, and Flask-Login as user management system.
I want to mimic this, but with MongoDB as backend, but all I'm finding is a huge rabbit hole with more options than I could ever dream of. I tried a few things here and there, but it's pretty hard to get the basic functionality working. A few questions:
* Does it still make sense to use Flask-login and create classes for User and Post? If yes, what do I inherit from aside from UserMixin?
* I've also looked into JSON Web Tokens combined with jsonschema, but I'm not sure how to translate Flask-login's classes to this. Is there any way to say this is "better" (e.g. more secure, ) than Flask-Login?
* Do Flask-PyMongo and Flask-MongoEngine have the same functionality?
* Just thinking outside the box: is it a good idea to have the login system in an RDBMS and another part of the data in a NoSQL DMS?
/r/flask
https://redd.it/axwypa
The Flask Mega Tutorial that uses SQLite, MySQL or PostgreSQL (via Flask-SQLAlchemy) as backend, and Flask-Login as user management system.
I want to mimic this, but with MongoDB as backend, but all I'm finding is a huge rabbit hole with more options than I could ever dream of. I tried a few things here and there, but it's pretty hard to get the basic functionality working. A few questions:
* Does it still make sense to use Flask-login and create classes for User and Post? If yes, what do I inherit from aside from UserMixin?
* I've also looked into JSON Web Tokens combined with jsonschema, but I'm not sure how to translate Flask-login's classes to this. Is there any way to say this is "better" (e.g. more secure, ) than Flask-Login?
* Do Flask-PyMongo and Flask-MongoEngine have the same functionality?
* Just thinking outside the box: is it a good idea to have the login system in an RDBMS and another part of the data in a NoSQL DMS?
/r/flask
https://redd.it/axwypa
reddit
r/flask - User login system in MongoDB using Flask?
1 vote and 0 comments so far on Reddit
[AF] Using flask_jwt, how can I redirect after successful authentication?
I hope this isn't too silly of a question. So if a user goes to /auth, and they successfully authenticate, I want to redirect them to another resource so I can log their IP address. So I'm thinking I need to redirect after /auth to something else like /ip and log their IP at that resource.
Does anyone have any insight they could offer? Thanks!
/r/flask
https://redd.it/axuuqi
I hope this isn't too silly of a question. So if a user goes to /auth, and they successfully authenticate, I want to redirect them to another resource so I can log their IP address. So I'm thinking I need to redirect after /auth to something else like /ip and log their IP at that resource.
Does anyone have any insight they could offer? Thanks!
/r/flask
https://redd.it/axuuqi
reddit
r/flask - [AF] Using flask_jwt, how can I redirect after successful authentication?
1 vote and 1 comment so far on Reddit
I just published a video on how to discover hidden Web APIs so that you can use them through your python programs. More interesting examples coming soon!
https://youtu.be/twuhocLtGCg
/r/Python
https://redd.it/axxh75
https://youtu.be/twuhocLtGCg
/r/Python
https://redd.it/axxh75
YouTube
Discovering Hidden APIs | Part-1 (GeeksforGeeks Compiler API)
Many a times, websites do not make their APIs public and use them privately on their webpages.
In this video, learn how to discover and explore those web APIs and use them in your Python programs. We take GeeksforGeeks IDE as an example.
Code: https://…
In this video, learn how to discover and explore those web APIs and use them in your Python programs. We take GeeksforGeeks IDE as an example.
Code: https://…
Introducing TraefikProxy, a new JupyterHub proxy based on Traefik
https://blog.jupyter.org/introducing-traefikproxy-a-new-jupyterhub-proxy-based-on-traefik-4839e972faf6
/r/IPython
https://redd.it/ay0cpp
https://blog.jupyter.org/introducing-traefikproxy-a-new-jupyterhub-proxy-based-on-traefik-4839e972faf6
/r/IPython
https://redd.it/ay0cpp
Medium
Introducing TraefikProxy, a new JupyterHub proxy based on Traefik
Removing the single point of failure from your JupyterHub infrastructure with traefik, etcd and Outreachy
Microsoft Releases PySpark Library for Distributed Search Engine Creation and Recommendation
https://github.com/Azure/mmlspark/releases/tag/v0.16
/r/Python
https://redd.it/axzlhv
https://github.com/Azure/mmlspark/releases/tag/v0.16
/r/Python
https://redd.it/axzlhv
GitHub
Azure/mmlspark
Microsoft Machine Learning for Apache Spark. Contribute to Azure/mmlspark development by creating an account on GitHub.
Using PyInstaller to Easily Distribute Python Applications
https://realpython.com/pyinstaller-python/
/r/Python
https://redd.it/ay0574
https://realpython.com/pyinstaller-python/
/r/Python
https://redd.it/ay0574
Realpython
Using PyInstaller to Easily Distribute Python Applications – Real Python
In this step-by-step tutorial, you'll learn how to use PyInstaller to turn your Python application into an executable with no dependencies or installation required. This is great if you want to distribute applications to users who may or may not be Python…