Python 3.13 RC2 Available Today - Python 3.13 available October 1st
Python 3.13 will drop on October 1st.
The second release candidate just dropped today.
Don't be afraid to upgrade.
Install the RC2 from here and run your regression tests for your applications, and be ready to upgrade to Python 3.13 the moment it becomes available on October 1st.
If any of your dependencies fail when running your application on the RC2, immediately raise an issue on their github and complain loudly that they need to make the changes to make it compatible as well as publish binary wheels.
https://www.python.org/downloads/release/python-3130rc2/
/r/Python
https://redd.it/1fbb4qw
Python 3.13 will drop on October 1st.
The second release candidate just dropped today.
Don't be afraid to upgrade.
Install the RC2 from here and run your regression tests for your applications, and be ready to upgrade to Python 3.13 the moment it becomes available on October 1st.
If any of your dependencies fail when running your application on the RC2, immediately raise an issue on their github and complain loudly that they need to make the changes to make it compatible as well as publish binary wheels.
https://www.python.org/downloads/release/python-3130rc2/
/r/Python
https://redd.it/1fbb4qw
Python.org
Python Release Python 3.13.0rc2
The official home of the Python Programming Language
Issues with Cloud Run Deployment
I've been trying to solve this deployment issue for 2 days now and am at my wits end. I've deployed on VPSs before but never a managed service like Cloud Run.
All of my request coming from the frontend are getting the Network Error: ERR\_TOO\_MANY\_REDIRECTS. From what I've gathered, there is likely and issue with the way django is processing the internal request from Cloud Run. The google documentation says that we need to add this to our settings.py:
CLOUDRUN_SERVICE_URL = env("CLOUDRUN_SERVICE_URL", default=None)
if CLOUDRUN_SERVICE_URL:
ALLOWED_HOSTS = [urlparse(CLOUDRUN_SERVICE_URL).netloc]
CSRF_TRUSTED_ORIGINS = [CLOUDRUN_SERVICE_URL]
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
I have added this and still continue to get these errors. I'm really not sure what else to look into or what could be causing this. I'm even will to pay you for your time if someone is willing to get on discord with me and help me work this out.
/r/django
https://redd.it/1fbcybz
I've been trying to solve this deployment issue for 2 days now and am at my wits end. I've deployed on VPSs before but never a managed service like Cloud Run.
All of my request coming from the frontend are getting the Network Error: ERR\_TOO\_MANY\_REDIRECTS. From what I've gathered, there is likely and issue with the way django is processing the internal request from Cloud Run. The google documentation says that we need to add this to our settings.py:
CLOUDRUN_SERVICE_URL = env("CLOUDRUN_SERVICE_URL", default=None)
if CLOUDRUN_SERVICE_URL:
ALLOWED_HOSTS = [urlparse(CLOUDRUN_SERVICE_URL).netloc]
CSRF_TRUSTED_ORIGINS = [CLOUDRUN_SERVICE_URL]
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
I have added this and still continue to get these errors. I'm really not sure what else to look into or what could be causing this. I'm even will to pay you for your time if someone is willing to get on discord with me and help me work this out.
/r/django
https://redd.it/1fbcybz
Reddit
From the django community on Reddit
Explore this post and more from the django community
Adding Python to Docker in 2 seconds using uv's Python command
Had great success speeding up our Docker workflow over at Talk Python using the brand new features of uv for managing Python and virtual environments. Wrote it up if you're interested:
https://mkennedy.codes/posts/python-docker-images-using-uv-s-new-python-features/
/r/Python
https://redd.it/1fb9qcy
Had great success speeding up our Docker workflow over at Talk Python using the brand new features of uv for managing Python and virtual environments. Wrote it up if you're interested:
https://mkennedy.codes/posts/python-docker-images-using-uv-s-new-python-features/
/r/Python
https://redd.it/1fb9qcy
Michael Kennedy's Thoughts on Technology
Docker images using uv's python
uv has added a new way to build Python-based containers.
How can I change the name options of this selectField based on which table was selected earlier in the form?
Edit: I fixed this issue by setting name = (column name) in each of the classes
-------------
Pretty much I am using a tutorial to make a form that will change possible selection option based on a previous selection. eg. a user chooses to see data filtered based on site and then have another dropdown with the possible site options.
the tutorial I am using uses only one table (see image one) but I have three different tables that need to be available for selection.
so far I have tried using both a variable and a function to do this but neither have worked. (the variable returned multiple selections of sites.site_name for each id in the table and the function returned multiples of <function results.<locals>.tableOptionName at 0x10e386e50>.
If it helps, the column that contains the names I am trying to display is the the second column the table for all three.
what I have at the moment is in image 2
image 1
image 2
Thank you so much!
/r/flask
https://redd.it/1fbhsk1
Edit: I fixed this issue by setting name = (column name) in each of the classes
-------------
Pretty much I am using a tutorial to make a form that will change possible selection option based on a previous selection. eg. a user chooses to see data filtered based on site and then have another dropdown with the possible site options.
the tutorial I am using uses only one table (see image one) but I have three different tables that need to be available for selection.
so far I have tried using both a variable and a function to do this but neither have worked. (the variable returned multiple selections of sites.site_name for each id in the table and the function returned multiples of <function results.<locals>.tableOptionName at 0x10e386e50>.
If it helps, the column that contains the names I am trying to display is the the second column the table for all three.
what I have at the moment is in image 2
image 1
image 2
Thank you so much!
/r/flask
https://redd.it/1fbhsk1
Sunday Daily Thread: What's everyone working on this week?
# Weekly Thread: What's Everyone Working On This Week? π οΈ
Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! π
/r/Python
https://redd.it/1fbku4v
# Weekly Thread: What's Everyone Working On This Week? π οΈ
Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! π
/r/Python
https://redd.it/1fbku4v
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Custom Template filters for global use
I am building a project and created a filter to format phone numbers. initially I created it inside one of my apps but decided since it could be use for the whole project to put it at project level but now its not working and giving me
TemplateSyntaxError at /
Invalid filter: 'formatphonenumber'
here is the file structure
projectManager/
βββ main/
β βββ settings.py
βββ onboarding/
βββ templates/
β βββ base.html
βββ templatetags/
β βββ init.py
β βββ customfilters.py
βββ theme/
βββ unit/
βββ manage.py
the custom\filter.py contents
from
django
import
/r/django
https://redd.it/1fbjtdq
I am building a project and created a filter to format phone numbers. initially I created it inside one of my apps but decided since it could be use for the whole project to put it at project level but now its not working and giving me
TemplateSyntaxError at /
Invalid filter: 'formatphonenumber'
here is the file structure
projectManager/
βββ main/
β βββ settings.py
βββ onboarding/
βββ templates/
β βββ base.html
βββ templatetags/
β βββ init.py
β βββ customfilters.py
βββ theme/
βββ unit/
βββ manage.py
the custom\filter.py contents
from
django
import
/r/django
https://redd.it/1fbjtdq
Reddit
From the django community on Reddit
Explore this post and more from the django community
Can't get Cloudfront to work (Heroku + Whitenoise)
Hi experts, thanks for any advice: as the title says, am in deployment on Heroku, am using Whitenoise. I have set up CloudFront as per directions from Whitenoise: https://whitenoise.readthedocs.io/en/latest/django.html#instructions-for-amazon-cloudfront, but it just doesn't want to work - e.g. my admin page has no CSS. I have put my app domain under origins in Cloudfront settings of course and have changed no other settings.
Settings:
STATIC_ROOT = BASE_DIR / "staticfiles"
Successful without Cloudfront
STATIC_URL = "static/"
Unsuccessful with Cloudfront
STATIC_HOST = os.environ.get("DJANGO_STATIC_HOST", "")
STATIC_URL = STATIC_HOST + "/static/" #https://xxxxxxxx.cloudfront.net/static
Logs aren't returning errors, but the Browser console is returning various "rejected" messages - it just can't see the Cloudfront resources, or there is some other security setting I need to change. It's driving me nuts: thanks for any tips you can give!
/r/django
https://redd.it/1fbgomg
Hi experts, thanks for any advice: as the title says, am in deployment on Heroku, am using Whitenoise. I have set up CloudFront as per directions from Whitenoise: https://whitenoise.readthedocs.io/en/latest/django.html#instructions-for-amazon-cloudfront, but it just doesn't want to work - e.g. my admin page has no CSS. I have put my app domain under origins in Cloudfront settings of course and have changed no other settings.
Settings:
STATIC_ROOT = BASE_DIR / "staticfiles"
Successful without Cloudfront
STATIC_URL = "static/"
Unsuccessful with Cloudfront
STATIC_HOST = os.environ.get("DJANGO_STATIC_HOST", "")
STATIC_URL = STATIC_HOST + "/static/" #https://xxxxxxxx.cloudfront.net/static
Logs aren't returning errors, but the Browser console is returning various "rejected" messages - it just can't see the Cloudfront resources, or there is some other security setting I need to change. It's driving me nuts: thanks for any tips you can give!
/r/django
https://redd.it/1fbgomg
Need to make sure I added the fields from my model correctly in
Hey guys, new to Reddit here. I'm new to Haystack/Solr. I have a Django project and I'm using Haystack to build a search index for the data in my PostgreSQL database. Here is my `search_indexes.py` code ```
from haystack import indexes
from .models import Arborist
class ArboristIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
arborist_city = indexes.CharField(model_attr='city')
arborist_state = indexes.CharField(model_attr='state')
price = indexes.PositiveIntegerField()
company_name = indexes.CharField(model_attr='company')
one_star = indexes.PositiveIntegerField(default=0, null=True, blank=True)
two_stars = indexes.PositiveIntegerField(default=0, null=True, blank=True)
three_stars = indexes.PositiveIntegerField(default=0, null=True, blank=True)
four_stars = indexes.PositiveIntegerField(default=0, null=True, blank=True)
five_stars = indexes.PositiveIntegerField(default=0, null=True, blank=True)
review_by_homeowner = indexes.CharField(model_attr='reviews')
tree_pruning = indexes.CharField(model_attr='tree_pruning')
tree_removal = indexes.CharField(model_attr='tree_removal')
tree_planting = indexes.CharField(model_attr='tree_planting')
pesticide_applications = indexes.CharField(model_attr='pesticide_applications')
soil_management = indexes.CharField(model_attr='soil_management')
tree_protection = indexes.CharField(model_attr='tree_protection')
tree_risk_management = indexes.CharField(model_attr='tree_risk_management')
tree_biology = indexes.CharField(model_attr='tree_biology')
def get_model(self):
return Arborist
def prepare_arborist_cty(self, obj):
return [arborist_city.id for arborist_city in obj.aborist_city_set.active().order_by('-created')\]
```. I'm also following the docs tutorial https://django-haystack.readthedocs.io/en/v2.4.1/tutorial.html. Where I'm stuck, is that some of these fields are different field types than what the tutorial is using, for example, `PositiveInteger` and also some of these fields are from two other models that are foreign keys to this `Arborist` model.
I just want to make sure that I'm setting up the fields properly to be indexed. It's probably best to view this in my Github repo https://github.com/remoteconn-7891/MyProject/tree/master since I have five different model files in my models folder. I was using Discord Django, but they weren't helpful with this
/r/djangolearning
https://redd.it/1fbmrpe
search_indexes.py file. This is a Haystack/Solr questionHey guys, new to Reddit here. I'm new to Haystack/Solr. I have a Django project and I'm using Haystack to build a search index for the data in my PostgreSQL database. Here is my `search_indexes.py` code ```
from haystack import indexes
from .models import Arborist
class ArboristIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
arborist_city = indexes.CharField(model_attr='city')
arborist_state = indexes.CharField(model_attr='state')
price = indexes.PositiveIntegerField()
company_name = indexes.CharField(model_attr='company')
one_star = indexes.PositiveIntegerField(default=0, null=True, blank=True)
two_stars = indexes.PositiveIntegerField(default=0, null=True, blank=True)
three_stars = indexes.PositiveIntegerField(default=0, null=True, blank=True)
four_stars = indexes.PositiveIntegerField(default=0, null=True, blank=True)
five_stars = indexes.PositiveIntegerField(default=0, null=True, blank=True)
review_by_homeowner = indexes.CharField(model_attr='reviews')
tree_pruning = indexes.CharField(model_attr='tree_pruning')
tree_removal = indexes.CharField(model_attr='tree_removal')
tree_planting = indexes.CharField(model_attr='tree_planting')
pesticide_applications = indexes.CharField(model_attr='pesticide_applications')
soil_management = indexes.CharField(model_attr='soil_management')
tree_protection = indexes.CharField(model_attr='tree_protection')
tree_risk_management = indexes.CharField(model_attr='tree_risk_management')
tree_biology = indexes.CharField(model_attr='tree_biology')
def get_model(self):
return Arborist
def prepare_arborist_cty(self, obj):
return [arborist_city.id for arborist_city in obj.aborist_city_set.active().order_by('-created')\]
```. I'm also following the docs tutorial https://django-haystack.readthedocs.io/en/v2.4.1/tutorial.html. Where I'm stuck, is that some of these fields are different field types than what the tutorial is using, for example, `PositiveInteger` and also some of these fields are from two other models that are foreign keys to this `Arborist` model.
I just want to make sure that I'm setting up the fields properly to be indexed. It's probably best to view this in my Github repo https://github.com/remoteconn-7891/MyProject/tree/master since I have five different model files in my models folder. I was using Discord Django, but they weren't helpful with this
/r/djangolearning
https://redd.it/1fbmrpe
Loom, python library to animate visualizations
I just exported loom, a python library that can animated your plots and graphs to make them more catchy. Check out the demo here : https://youtu.be/5eZqREtMW_Y?si=hJCJbt7sXdWAnCdQ
/r/Python
https://redd.it/1fbr7n7
I just exported loom, a python library that can animated your plots and graphs to make them more catchy. Check out the demo here : https://youtu.be/5eZqREtMW_Y?si=hJCJbt7sXdWAnCdQ
/r/Python
https://redd.it/1fbr7n7
YouTube
How to animate your python plots and graphs?
This video demonstrates loom, a python library which helps to animate any python plot in no time. Check out the demo in this video #ai #ml #python #visualization #datascience
VitePress vs. Material for MkDocs
Hey everyone,
Iβm torn between using VitePress and Material for MkDocs to generate documentation for my code.
# mkdocstring support
I prefer VitePress for its interface, but Material for MkDocs can generate HTML directly from the source code and docstrings thanks to mkdocstrings library (see an example here), which VitePress doesnβt seem to support (or maybe I'm missing something?).
# Question
Why is such a common feature not available in VitePress? Would love to hear your thoughts or workarounds!
/r/Python
https://redd.it/1fbs772
Hey everyone,
Iβm torn between using VitePress and Material for MkDocs to generate documentation for my code.
# mkdocstring support
I prefer VitePress for its interface, but Material for MkDocs can generate HTML directly from the source code and docstrings thanks to mkdocstrings library (see an example here), which VitePress doesnβt seem to support (or maybe I'm missing something?).
# Question
Why is such a common feature not available in VitePress? Would love to hear your thoughts or workarounds!
/r/Python
https://redd.it/1fbs772
VitePress
VitePress | Vite & Vue powered static site generator.
global installations or project-specific environments
When installing libraries on python which one is better? Global installations or project-specific environment installation? Can you also write important bulletpoints for each?
/r/Python
https://redd.it/1fbs3ge
When installing libraries on python which one is better? Global installations or project-specific environment installation? Can you also write important bulletpoints for each?
/r/Python
https://redd.it/1fbs3ge
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Flask authorization question β
Welcome, I am a jonuior web developer,
I have a question, now I know how can I implement a an authentication functionality with flask, flask-login, and also can I implement a More than role like an admin role manager role, and an employee role, I defined this roles in the code after the routes definition, and that's not helpful and not easiler in the development, what's the best way to can I implement the authorization functionality? I hope to find something let me to add the authorization feature for the client, as example like if I build a hr management system, the admin can add the employees and can add a new role from the GUI , and can select if The employee can add or read or update for something, and he also can select what is the page's the employee can access to it,
Please share the best resources and toturials for that, thanks guys.
/r/flask
https://redd.it/1fam8as
Welcome, I am a jonuior web developer,
I have a question, now I know how can I implement a an authentication functionality with flask, flask-login, and also can I implement a More than role like an admin role manager role, and an employee role, I defined this roles in the code after the routes definition, and that's not helpful and not easiler in the development, what's the best way to can I implement the authorization functionality? I hope to find something let me to add the authorization feature for the client, as example like if I build a hr management system, the admin can add the employees and can add a new role from the GUI , and can select if The employee can add or read or update for something, and he also can select what is the page's the employee can access to it,
Please share the best resources and toturials for that, thanks guys.
/r/flask
https://redd.it/1fam8as
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
R Training models with multiple losses
Instead of using gradient descent to minimize a single loss, we propose to use Jacobian descent to minimize multiple losses simultaneously. Basically, this algorithm updates the parameters of the model by reducing the Jacobian of the (vector-valued) objective function into an update vector.
To make it accessible to everyone, we have developed TorchJD: a library extending autograd to support Jacobian descent. After a simple
Github: https://github.com/TorchJD/torchjd
Documentation: https://torchjd.org
Paper: https://arxiv.org/pdf/2406.16232
We would love to hear some feedback from the community. If you want to support us, a star on the repo would be grealy appreciated! We're also open to discussion and criticism.
/r/MachineLearning
https://redd.it/1fbvuhs
Instead of using gradient descent to minimize a single loss, we propose to use Jacobian descent to minimize multiple losses simultaneously. Basically, this algorithm updates the parameters of the model by reducing the Jacobian of the (vector-valued) objective function into an update vector.
To make it accessible to everyone, we have developed TorchJD: a library extending autograd to support Jacobian descent. After a simple
pip install torchjd, transforming a PyTorch-based training function is very easy. With the recent release v0.2.0, TorchJD finally supports multi-task learning!Github: https://github.com/TorchJD/torchjd
Documentation: https://torchjd.org
Paper: https://arxiv.org/pdf/2406.16232
We would love to hear some feedback from the community. If you want to support us, a star on the repo would be grealy appreciated! We're also open to discussion and criticism.
/r/MachineLearning
https://redd.it/1fbvuhs
GitHub
GitHub - TorchJD/torchjd: Library for Jacobian descent with PyTorch. It enables the optimization of neural networks with multipleβ¦
Library for Jacobian descent with PyTorch. It enables the optimization of neural networks with multiple losses (e.g. multi-task learning). - TorchJD/torchjd
winaccent - A Python module for getting Windows' accent color or a shade of it
# What my project does
winaccent allows you to get the Windows' accent color or a shade of it. Works on both Windows 10 and 11 and doesn't require additional dependencies. Useful if you are creating a GUI using Python and you want to style your app with the system's accent color.
# Target audience
It is meant for production.
# Comparison
Unlike other alternatives that only allow you to get the accent color, this project also allows you to get a shade of it. Also, it allows you to listen for accent color changes for easily updating your app's colors to match it.
# Installation
The module can be installed using the following command:
pip install winaccent
# Documentation & Source code
The documentation and the source code is available here: https://github.com/Valer100/winaccent . Feedback is greatly appreciated. If you found this module useful, please consider starring it on GitHub.
/r/Python
https://redd.it/1fbvhmr
# What my project does
winaccent allows you to get the Windows' accent color or a shade of it. Works on both Windows 10 and 11 and doesn't require additional dependencies. Useful if you are creating a GUI using Python and you want to style your app with the system's accent color.
# Target audience
It is meant for production.
# Comparison
Unlike other alternatives that only allow you to get the accent color, this project also allows you to get a shade of it. Also, it allows you to listen for accent color changes for easily updating your app's colors to match it.
# Installation
The module can be installed using the following command:
pip install winaccent
# Documentation & Source code
The documentation and the source code is available here: https://github.com/Valer100/winaccent . Feedback is greatly appreciated. If you found this module useful, please consider starring it on GitHub.
/r/Python
https://redd.it/1fbvhmr
GitHub
GitHub - Valer100/winaccent: A simple and lightweight Python module for easily retrieving Windows' accent color, including shadesβ¦
A simple and lightweight Python module for easily retrieving Windows' accent color, including shades, specific window chrome colors and theme. Supports Windows 8.x, 10 and 11 and doesn&...
Thoughts about my project design
Hey all, hope everyone is good!
Brief introduction to me: A data engineer with 4+ years of experience and 3+ years of experience in AWS who is currently employed at one of the big automative company. I did one freelance django project in the past and now I am doing another one for my wife whom is a yoga instructor.
The requirements of the project:
Subscription based model that people can subscribe and watch her content in the website
Auth, registering, video streaming, stripe, paypal
Assuming will be 50 active users in the beginning can increase to 500 in 1 year
Assuming there will be 30gb of video content in the beginning and it may increase to \~100gb in one year
1 developer is developing the project, it is me
Decisions:
After a pricing research I decided to use digital ocean because it was giving better server with a cheaper cost also the data transfer limits.
I did not wanted to use a managed pg db because of cost also the db load will be very low due to number of active users, for that reason I decided to up all the system on docker
I set hourly email backups, the size
/r/django
https://redd.it/1fbw4se
Hey all, hope everyone is good!
Brief introduction to me: A data engineer with 4+ years of experience and 3+ years of experience in AWS who is currently employed at one of the big automative company. I did one freelance django project in the past and now I am doing another one for my wife whom is a yoga instructor.
The requirements of the project:
Subscription based model that people can subscribe and watch her content in the website
Auth, registering, video streaming, stripe, paypal
Assuming will be 50 active users in the beginning can increase to 500 in 1 year
Assuming there will be 30gb of video content in the beginning and it may increase to \~100gb in one year
1 developer is developing the project, it is me
Decisions:
After a pricing research I decided to use digital ocean because it was giving better server with a cheaper cost also the data transfer limits.
I did not wanted to use a managed pg db because of cost also the db load will be very low due to number of active users, for that reason I decided to up all the system on docker
I set hourly email backups, the size
/r/django
https://redd.it/1fbw4se
Reddit
From the django community on Reddit
Explore this post and more from the django community
I need some help with an issue regarding enumerations in Flask.
I need some help with an issue regarding enumerations in Flask.
My model is as follows:
```python
class ApprovalStatus(PyEnum):
PENDING = 'pending'
APPROVED = 'approved'
REJECTED = 'rejected'
class Approval(db.Model):
id = db.Column(db.Integer, primary_key=True)
content_type = db.Column(db.String(50), nullable=False)
content_id = db.Column(db.Integer, nullable=False)
field_name = db.Column(db.String(50), nullable=False)
new_value = db.Column(db.Text, nullable=False)
status = db.Column(SQLAlchemyEnum(ApprovalStatus), default=ApprovalStatus.PENDING)
submitter_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
submit_time = db.Column(db.DateTime, default=current_time)
reviewer_id = db.Column(db.Integer, db.ForeignKey('user.id'))
review_time = db.Column(db.DateTime, default=current_time)
review_comment = db.Column(db.Text)
submitter = db.relationship('User', foreign_keys=[submitter_id\])
reviewer = db.relationship('User', foreign_keys=[reviewer_id\])
__table_args__ = (UniqueConstraint('content_type', 'content_id'),)
u/property
def content(self):
model = getattr(models, self.content_type)
return model.query.get(self.content_id)
```
However, I keep encountering the following error:
```
LookupError: 'pending' is not among the defined enum values. Enum name: approvalstatus. Possible values: PENDING, APPROVED, REJECTED
```
/r/flask
https://redd.it/1fc2ltr
I need some help with an issue regarding enumerations in Flask.
My model is as follows:
```python
class ApprovalStatus(PyEnum):
PENDING = 'pending'
APPROVED = 'approved'
REJECTED = 'rejected'
class Approval(db.Model):
id = db.Column(db.Integer, primary_key=True)
content_type = db.Column(db.String(50), nullable=False)
content_id = db.Column(db.Integer, nullable=False)
field_name = db.Column(db.String(50), nullable=False)
new_value = db.Column(db.Text, nullable=False)
status = db.Column(SQLAlchemyEnum(ApprovalStatus), default=ApprovalStatus.PENDING)
submitter_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
submit_time = db.Column(db.DateTime, default=current_time)
reviewer_id = db.Column(db.Integer, db.ForeignKey('user.id'))
review_time = db.Column(db.DateTime, default=current_time)
review_comment = db.Column(db.Text)
submitter = db.relationship('User', foreign_keys=[submitter_id\])
reviewer = db.relationship('User', foreign_keys=[reviewer_id\])
__table_args__ = (UniqueConstraint('content_type', 'content_id'),)
u/property
def content(self):
model = getattr(models, self.content_type)
return model.query.get(self.content_id)
```
However, I keep encountering the following error:
```
LookupError: 'pending' is not among the defined enum values. Enum name: approvalstatus. Possible values: PENDING, APPROVED, REJECTED
```
/r/flask
https://redd.it/1fc2ltr
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Just Released Version 0.4.0 of Django Action Triggers!
First off, a huge thank you to everyone who provided feedback after the release of version 0.1.0! I've taken your input to heart and have been hard at work iterating. Iβm excited to announce the release of **version 0.4.0** of **django-action-triggers**.
Thereβs still more to come in terms of features and addressing suggestions, but hereβs an overview of the current progress.
# What is Django Action Triggers
[Django Action Triggers](https://github.com/Salaah01/django-action-triggers) is a Django library that lets you trigger specific actions based on database events, detected via Django Signals. With this library, you can configure **actions** that run asynchronously when certain triggers (e.g., a model save) are detected.
For example, you could set up a trigger that hits a webhook and sends a message to AWS SQS whenever a new sale record is saved.
# What's New in Version 0.4.0?
Hereβs a quick comparison of **version 0.1.0** vs. **version 0.4.0**:
**Version 0.1.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
**Version 0.4.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
* Redis integration
* AWS SQS (Simple Queue Service) integration
* AWS SNS (Simple Notification Service) integration
* Actions all run asynchronously
* Actions can have a timeout
# Looking Forward
As always, Iβd love to hear your feedback. This project started as a passion project but has
/r/Python
https://redd.it/1fc2t9a
First off, a huge thank you to everyone who provided feedback after the release of version 0.1.0! I've taken your input to heart and have been hard at work iterating. Iβm excited to announce the release of **version 0.4.0** of **django-action-triggers**.
Thereβs still more to come in terms of features and addressing suggestions, but hereβs an overview of the current progress.
# What is Django Action Triggers
[Django Action Triggers](https://github.com/Salaah01/django-action-triggers) is a Django library that lets you trigger specific actions based on database events, detected via Django Signals. With this library, you can configure **actions** that run asynchronously when certain triggers (e.g., a model save) are detected.
For example, you could set up a trigger that hits a webhook and sends a message to AWS SQS whenever a new sale record is saved.
# What's New in Version 0.4.0?
Hereβs a quick comparison of **version 0.1.0** vs. **version 0.4.0**:
**Version 0.1.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
**Version 0.4.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
* Redis integration
* AWS SQS (Simple Queue Service) integration
* AWS SNS (Simple Notification Service) integration
* Actions all run asynchronously
* Actions can have a timeout
# Looking Forward
As always, Iβd love to hear your feedback. This project started as a passion project but has
/r/Python
https://redd.it/1fc2t9a
GitHub
GitHub - Salaah01/django-action-triggers: A Django library for asynchronously triggering actions in response to database changes.β¦
A Django library for asynchronously triggering actions in response to database changes. It supports integration with webhooks, message brokers (e.g., Kafka, RabbitMQ), and can trigger other process...
Audio Book Reader: Read .epub, .rtf, and .txt as audio books!
https://github.com/RNRetailer/audio-book-reader
What My Project Does
This program is for the Linux terminal.
It breaks text files into lines and reads them out loud one line at a time.
Your progress for each file is stored in a .json file.
You can choose to skip to a certain line by passing it as a parameter when running the script.
Please make an issue or a pull request if you think any changes are needed.
Thanks!
Target Audience (e.g., Is it meant for production, just a toy project, etc.)
Anyone who uses Linux and wants to have a text file read out loud to them.
Comparison (A brief comparison explaining how it differs from existing alternatives.)
I haven't looked into alternatives in this space, I just made it on a whim.
/r/Python
https://redd.it/1fb3f8p
https://github.com/RNRetailer/audio-book-reader
What My Project Does
This program is for the Linux terminal.
It breaks text files into lines and reads them out loud one line at a time.
Your progress for each file is stored in a .json file.
You can choose to skip to a certain line by passing it as a parameter when running the script.
Please make an issue or a pull request if you think any changes are needed.
Thanks!
Target Audience (e.g., Is it meant for production, just a toy project, etc.)
Anyone who uses Linux and wants to have a text file read out loud to them.
Comparison (A brief comparison explaining how it differs from existing alternatives.)
I haven't looked into alternatives in this space, I just made it on a whim.
/r/Python
https://redd.it/1fb3f8p
GitHub
GitHub - RNRetailer/audio-book-reader: Reads text files and outputs audio one sentence at a time. Saves progress. Runs in Linuxβ¦
Reads text files and outputs audio one sentence at a time. Saves progress. Runs in Linux terminal. - RNRetailer/audio-book-reader
How do I stop my Socket IO chat room from disconnecting users 30 seconds after joining the room? I'm hosting using Adaptable's free plan.
I've been working on a chat room application using Flask and JS where you can join a room and message people and it works fine on my local server but when I access the site from Adaptable, 30 seconds into joining a room, it boots the user out, so I was wondering if anyone knows why this is happening. I've tried a couple solutions already including implementing a heartbeat. Any help would be great, I'm just trying to diagnose the issue. Thanks!
/r/flask
https://redd.it/1fcag2y
I've been working on a chat room application using Flask and JS where you can join a room and message people and it works fine on my local server but when I access the site from Adaptable, 30 seconds into joining a room, it boots the user out, so I was wondering if anyone knows why this is happening. I've tried a couple solutions already including implementing a heartbeat. Any help would be great, I'm just trying to diagnose the issue. Thanks!
/r/flask
https://redd.it/1fcag2y
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
My first flask app
As an avid sports lover, I've often faced the challenge of finding training partners, especially after relocating to a new city. This inspired me to create Sport CoTrain, a platform where fellow sports lovers can connect, post their activities, and find co-trainers.
I've built this app using Flask and basic HTML, keeping it simple yet functional. While it's still in its early stages, I'm excited to share it with the community and would greatly appreciate your feedback.
Sport CoTrain aims to solve a common problem for active individuals, making it easier to maintain an engaging workout routine and meet like-minded people. I'm looking forward to hearing your thoughts and suggestions to improve the app.
Thank you all for your time and potential input!
Link to app: https://sportcotrain.com/
/r/flask
https://redd.it/1fccgt7
As an avid sports lover, I've often faced the challenge of finding training partners, especially after relocating to a new city. This inspired me to create Sport CoTrain, a platform where fellow sports lovers can connect, post their activities, and find co-trainers.
I've built this app using Flask and basic HTML, keeping it simple yet functional. While it's still in its early stages, I'm excited to share it with the community and would greatly appreciate your feedback.
Sport CoTrain aims to solve a common problem for active individuals, making it easier to maintain an engaging workout routine and meet like-minded people. I'm looking forward to hearing your thoughts and suggestions to improve the app.
Thank you all for your time and potential input!
Link to app: https://sportcotrain.com/
/r/flask
https://redd.it/1fccgt7