Can you share tutorials on django channels?
Hi I am building a app which creates a chat room in a local network for sending messages and files. This is my semester's final project and I thought how hard could it be. I knew how to use python sockets to make this work and thought how hard could it be to integrate it with django. I bit off way more than I could chew.
All I want it that the page updates it real time to display message. From what I read online I have to use websockets and channels to accomplish this, but I have no idea how any of this works. I have seen tutorials online and they all are too complicated and I am overwhelmed. Is there another way around this. All I want is to establish a connection between sockets and django channels. Please help
/r/djangolearning
https://redd.it/1i4ylfu
Hi I am building a app which creates a chat room in a local network for sending messages and files. This is my semester's final project and I thought how hard could it be. I knew how to use python sockets to make this work and thought how hard could it be to integrate it with django. I bit off way more than I could chew.
All I want it that the page updates it real time to display message. From what I read online I have to use websockets and channels to accomplish this, but I have no idea how any of this works. I have seen tutorials online and they all are too complicated and I am overwhelmed. Is there another way around this. All I want is to establish a connection between sockets and django channels. Please help
/r/djangolearning
https://redd.it/1i4ylfu
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Integrating Node-RED and Django for Easy Smart Applications Development
Hi Redditors! 👋
I’m excited to share my latest project:
**Node-RED - Django Integration**, which aims to combine **Node-RED**, a fantastic tool for visually building flows, with **Django**, one of the most popular frameworks for web application development.
# What Makes This Project Unique?
In Node-RED, you cannot control user access permissions.
* For example, if you want one user to view a device's readings but not modify them, while another user can both view and edit the device's readings, this is impossible in Node-RED.
* In Django, advanced permission handling is possible.
* You can define specific permissions for each device, allowing precise control over who can view or modify data.
* However, in Django, it is challenging to connect and manage multiple devices or control the flow of data.
* Unlike Node-RED, Django is not designed for creating seamless data flows or automation
Why This Project?
I wanted to explore the possibility of simplifying the development of smart applications using flexible and accessible tools. The goal is to empower developers to create fast, efficient applications by leveraging the strengths of both Node-RED and Django.
[link of project](https://github.com/taha2samy/node_red_-_django-quack_quack-)
# Examples from the Project:)
https://preview.redd.it/ynvvutm1tiee1.png?width=853&format=png&auto=webp&s=b9da984a3aaf91d7bf79bd98faabb32484c8a7b0
#
https://preview.redd.it/sngy1fm3tiee1.png?width=427&format=png&auto=webp&s=f07bbca6a3e38c121d926de806035a7925e12715
https://preview.redd.it/ht9s5ki5tiee1.png?width=1383&format=png&auto=webp&s=a8237be3ff909b68d0a02eec671ce168e6c0ffe7
/r/django
https://redd.it/1i77ztn
Hi Redditors! 👋
I’m excited to share my latest project:
**Node-RED - Django Integration**, which aims to combine **Node-RED**, a fantastic tool for visually building flows, with **Django**, one of the most popular frameworks for web application development.
# What Makes This Project Unique?
In Node-RED, you cannot control user access permissions.
* For example, if you want one user to view a device's readings but not modify them, while another user can both view and edit the device's readings, this is impossible in Node-RED.
* In Django, advanced permission handling is possible.
* You can define specific permissions for each device, allowing precise control over who can view or modify data.
* However, in Django, it is challenging to connect and manage multiple devices or control the flow of data.
* Unlike Node-RED, Django is not designed for creating seamless data flows or automation
Why This Project?
I wanted to explore the possibility of simplifying the development of smart applications using flexible and accessible tools. The goal is to empower developers to create fast, efficient applications by leveraging the strengths of both Node-RED and Django.
[link of project](https://github.com/taha2samy/node_red_-_django-quack_quack-)
# Examples from the Project:)
https://preview.redd.it/ynvvutm1tiee1.png?width=853&format=png&auto=webp&s=b9da984a3aaf91d7bf79bd98faabb32484c8a7b0
#
https://preview.redd.it/sngy1fm3tiee1.png?width=427&format=png&auto=webp&s=f07bbca6a3e38c121d926de806035a7925e12715
https://preview.redd.it/ht9s5ki5tiee1.png?width=1383&format=png&auto=webp&s=a8237be3ff909b68d0a02eec671ce168e6c0ffe7
/r/django
https://redd.it/1i77ztn
GitHub
GitHub - taha2samy/node_red_-_django-quack_quack-: An integrated system combining Django and Node-RED for flexible device management…
An integrated system combining Django and Node-RED for flexible device management, offering fine-grained access control, event logging, and high security, designed for scalability and customization...
Hello dear friends, I use Django 5 and I have problem
*\*\** $ python [manage.py](http://manage.py) runserver
Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). Error: You don't have permission to access that port. (venv) *\*\**
How I can solve it ?
/r/django
https://redd.it/1i7bo7h
*\*\** $ python [manage.py](http://manage.py) runserver
Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). Error: You don't have permission to access that port. (venv) *\*\**
How I can solve it ?
/r/django
https://redd.it/1i7bo7h
Reddit
From the django community on Reddit
Explore this post and more from the django community
I am using flask for Google sign-in with fedcm but getting following errors...
/r/flask
https://redd.it/1i7dbdq
/r/flask
https://redd.it/1i7dbdq
Hardening my Django server
I've had a Django app running on a Digital Ocean droplet for several years without issue. Lately it would run out of memory on complex queries. The CPU was also hitting high levels. I decided to move to a Hetzner VM - 4 times the CPU and 4 times the memory for about the same price. Having updated all the software dependencies and dome lots of testing I finally migrated to the new server on Sunday. On Tuesday, by coincidence, I got a notification from Digital Ocean Security saying that they had received a report that my old DO server was making unauthorized connection attempts on a remote third-party server via SSH. As I now no longer needed that server, I responded by destroying it. (I don't have the time and expertise to analyse exactly what was going on.
Of course, I want to avoid such an issue recurring on the new server. So my question is: What measures beyond the standard Django deployment checklist (which I had followed) do you recommend for your Django servers? I'm using Nginx and Gunicorn on an ARM platform. I'm thinking of libraries like fail2ban, maybe a Web Application Firewall, scanners for malicious code
/r/django
https://redd.it/1i7br7c
I've had a Django app running on a Digital Ocean droplet for several years without issue. Lately it would run out of memory on complex queries. The CPU was also hitting high levels. I decided to move to a Hetzner VM - 4 times the CPU and 4 times the memory for about the same price. Having updated all the software dependencies and dome lots of testing I finally migrated to the new server on Sunday. On Tuesday, by coincidence, I got a notification from Digital Ocean Security saying that they had received a report that my old DO server was making unauthorized connection attempts on a remote third-party server via SSH. As I now no longer needed that server, I responded by destroying it. (I don't have the time and expertise to analyse exactly what was going on.
Of course, I want to avoid such an issue recurring on the new server. So my question is: What measures beyond the standard Django deployment checklist (which I had followed) do you recommend for your Django servers? I'm using Nginx and Gunicorn on an ARM platform. I'm thinking of libraries like fail2ban, maybe a Web Application Firewall, scanners for malicious code
/r/django
https://redd.it/1i7br7c
Reddit
From the django community on Reddit
Explore this post and more from the django community
TIL:
More details here: https://pythonspeed.com/articles/faster-pip-installs/
/r/Python
https://redd.it/1i7jz7c
uv pip install doesn't compile bytecode installationuv pip install is way faster than pip install, but today I learned that is not a completely fair comparison out of the box. By default, pip will compile .py files to .pyc as part of installation, and uv will not. That being said, uv is still faster even once you enable bytecode compilation (and you might want to if you're e.g. building a Docker image), but it's not as fast.More details here: https://pythonspeed.com/articles/faster-pip-installs/
/r/Python
https://redd.it/1i7jz7c
Python⇒Speed
Faster pip installs: caching, bytecode compilation, and uv
Installing packages with pip can be slow. Learn some ways to speed it up.
Setting Up Django for Success
Hello everyone,
I wrote a getting started guide I wish I had myself when I got started with Django around 8 years ago. It goes from setting up a virtual environment using `uv` to having a server side rendered front-end application hydrated using Vue. I tried to write it in such a way that you could achieve the same by using React/Svelte instead of Vue by only changing the Vite template. It contains a short piece of Django Rest Framework to demonstrate persistence via an authenticated API.
It's a collection of ideas that worked for me and others in the Django community. Some from books such as Two Scoops of Django. Others from resources such as LearnDjango.com or DjangoCon US talks. Of course duly credited where mentioned.
https://jilles.me/setting-up-django-for-success/
Hopefully there is something useful in there for everyone. I think it's a nice middle-ground between a completely empty Django project and a fully fledged django-cookiecutter.
/r/django
https://redd.it/1i7ekq1
Hello everyone,
I wrote a getting started guide I wish I had myself when I got started with Django around 8 years ago. It goes from setting up a virtual environment using `uv` to having a server side rendered front-end application hydrated using Vue. I tried to write it in such a way that you could achieve the same by using React/Svelte instead of Vue by only changing the Vite template. It contains a short piece of Django Rest Framework to demonstrate persistence via an authenticated API.
It's a collection of ideas that worked for me and others in the Django community. Some from books such as Two Scoops of Django. Others from resources such as LearnDjango.com or DjangoCon US talks. Of course duly credited where mentioned.
https://jilles.me/setting-up-django-for-success/
Hopefully there is something useful in there for everyone. I think it's a nice middle-ground between a completely empty Django project and a fully fledged django-cookiecutter.
/r/django
https://redd.it/1i7ekq1
Learndjango
Home
LearnDjango is a platform for learning Django, a popular Python web framework for building web
applications. It offers tutorials and courses to help you master your craft and boost your
career.
applications. It offers tutorials and courses to help you master your craft and boost your
career.
Unable to create virtual environment
I just started learning Flask and want to create a virtual environment within VSCode. I did install the virtualenv package using pip
pip install virtualenv
But when I enter the prompt "virtualenv env" to create a directory, I get a file not found error saying that "system cannot find file specified".
Why am I getting this error and how can I fix this?
/r/flask
https://redd.it/1i7imed
I just started learning Flask and want to create a virtual environment within VSCode. I did install the virtualenv package using pip
pip install virtualenv
But when I enter the prompt "virtualenv env" to create a directory, I get a file not found error saying that "system cannot find file specified".
Why am I getting this error and how can I fix this?
/r/flask
https://redd.it/1i7imed
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Best practice for allowing access to users without an account
I need to provide access to users who don't have an account on the site, and I want it to be properly routed. We manage condo associations, and want to let tenants report problems. Owners are no problem, they already have a website account to pay condo fees etc. But tenants don't. Is there a better way to do it than just giving them a url with a long UUID (ie domain.com/request/\[UUID\](http://domain.com/request/UUID) or similar) where the UUID would be tied to a particular unit so we could share it with the appropriate condo board?
/r/django
https://redd.it/1i7pxeo
I need to provide access to users who don't have an account on the site, and I want it to be properly routed. We manage condo associations, and want to let tenants report problems. Owners are no problem, they already have a website account to pay condo fees etc. But tenants don't. Is there a better way to do it than just giving them a url with a long UUID (ie domain.com/request/\[UUID\](http://domain.com/request/UUID) or similar) where the UUID would be tied to a particular unit so we could share it with the appropriate condo board?
/r/django
https://redd.it/1i7pxeo
D Comment on CVPR reviews and ICLR decisions.
Hey everyone,
We all know how reviews and decisions can be controversial, and I’m sure many of you are feeling disappointed with the results (My rating from CVPR is all 2 😅). But remember, it’s not the end of the world!
Rejection doesn’t mean you’re at fault—it’s often just bad luck (though, of course, we should always strive to improve our work).
Take a break—grab some chicken and beers, get a good night’s sleep, and gear up to submit your work to another venue. You’ve got this! 💪
/r/MachineLearning
https://redd.it/1i7nvix
Hey everyone,
We all know how reviews and decisions can be controversial, and I’m sure many of you are feeling disappointed with the results (My rating from CVPR is all 2 😅). But remember, it’s not the end of the world!
Rejection doesn’t mean you’re at fault—it’s often just bad luck (though, of course, we should always strive to improve our work).
Take a break—grab some chicken and beers, get a good night’s sleep, and gear up to submit your work to another venue. You’ve got this! 💪
/r/MachineLearning
https://redd.it/1i7nvix
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
Jypter Tries Opening in Photoshop instead of Browser
I am taking a Python class at my college, and as part of the class, we installed Anaconda and the Jypter Notebook to write our code in. Whenever I try to open Jypter Notebook, it opens up Photoshop on my laptop.
The TA for my class had me uninstall Photoshop, and it got Jypter Notebook to run. However, I need to keep Photoshop on my laptop for my internship, so I would prefer not to have to uninstall and re-install it.
Do y'all know a potential work around for this?
I appreciate any advice, thank you all.
Edit:
I just realized that i misspelled Juypter, my bad
/r/IPython
https://redd.it/1i7plj8
I am taking a Python class at my college, and as part of the class, we installed Anaconda and the Jypter Notebook to write our code in. Whenever I try to open Jypter Notebook, it opens up Photoshop on my laptop.
The TA for my class had me uninstall Photoshop, and it got Jypter Notebook to run. However, I need to keep Photoshop on my laptop for my internship, so I would prefer not to have to uninstall and re-install it.
Do y'all know a potential work around for this?
I appreciate any advice, thank you all.
Edit:
I just realized that i misspelled Juypter, my bad
/r/IPython
https://redd.it/1i7plj8
Reddit
From the IPython community on Reddit
Explore this post and more from the IPython community
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1i7q0kh
# Weekly Thread: Professional Use, Jobs, and Education 🏢
Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.
---
## How it Works:
1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.
---
## Guidelines:
- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.
---
## Example Topics:
1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?
---
Let's help each other grow in our careers and education. Happy discussing! 🌟
/r/Python
https://redd.it/1i7q0kh
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Improve Python code quality!
After spending about an hour on research for finding the best tools that can improve code quality, I came up with this trio:
- Linter: Ruff
- Formatter: Black
- Type Checker: Pyright
Is this good? Are there any suggestions you guys can give?
/r/Python
https://redd.it/1i7wus6
After spending about an hour on research for finding the best tools that can improve code quality, I came up with this trio:
- Linter: Ruff
- Formatter: Black
- Type Checker: Pyright
Is this good? Are there any suggestions you guys can give?
/r/Python
https://redd.it/1i7wus6
Reddit
From the Python community on Reddit: Improve Python code quality!
Posted by Zoory9900 - 53 votes and 54 comments
DjangoCon 2023 recordings are now available
Hi r/Python, just wanted to annouce that DjangoCon 2023 talks have just been uploaded and as part of Tech Talks Weekly, I went ahead and put together the full list ordered by the number of views:
1. **"Don't Buy the "A.I." Hype with Tim Allen"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 26m 26s
2. **"Let's build a BeeWare app that uses Django with Cheuk Ting Ho"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 41m 19s
3. **"Using database triggers to reliably track model history with Wes Kendall"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 37m 57s
4. **"✨ Modern editing experience for your Django models with Wagtail 🐦 with Sage Abdullah"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 24m 27s
5. **"There's More to Open Source than Code by Ramon Huidobro"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 16m 24s
6. **"HTML-ivating your Django web app's experience with HTMX, AlpineJS, and streaming HTML - Chris May"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 37m 50s
7. **"Nothing for Us, Without Us; Breaking Unconscious Bias in Building Products with Victor Ogunjobi"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 22m 17s
8. **"Hosting and DevOps
/r/Python
[https://redd.it/1i77bun
Hi r/Python, just wanted to annouce that DjangoCon 2023 talks have just been uploaded and as part of Tech Talks Weekly, I went ahead and put together the full list ordered by the number of views:
1. **"Don't Buy the "A.I." Hype with Tim Allen"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 26m 26s
2. **"Let's build a BeeWare app that uses Django with Cheuk Ting Ho"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 41m 19s
3. **"Using database triggers to reliably track model history with Wes Kendall"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 37m 57s
4. **"✨ Modern editing experience for your Django models with Wagtail 🐦 with Sage Abdullah"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 24m 27s
5. **"There's More to Open Source than Code by Ramon Huidobro"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 16m 24s
6. **"HTML-ivating your Django web app's experience with HTMX, AlpineJS, and streaming HTML - Chris May"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 37m 50s
7. **"Nothing for Us, Without Us; Breaking Unconscious Bias in Building Products with Victor Ogunjobi"** ⸱ <100 views ⸱ 20 Jan 2025 ⸱ 00h 22m 17s
8. **"Hosting and DevOps
/r/Python
[https://redd.it/1i77bun
YouTube
Don't Buy the "A.I." Hype with Tim Allen
"Those who cannot remember the past are condemned to repeat it."
George Santayana, The Life of Reason, 1905.
Congratulations, technologists! We have reached a new record for the height of the peak of inflated expectations with the hype surrounding "A.I."…
George Santayana, The Life of Reason, 1905.
Congratulations, technologists! We have reached a new record for the height of the peak of inflated expectations with the hype surrounding "A.I."…
How do I find internships?
Hey everyone. I'm currently on the lookout for a Django-related internship and wanted to ask for some advice. I've worked on quite a few Django projects. While I feel confident in my skills, I’m unsure how to approach finding the right internship opportunities.
For those of you who’ve landed Django internships, how did you do it? Did you find opportunities through specific job boards, open-source contributions, or cold emailing companies?
Any tips, resources, or strategies would be super helpful!
Thanks in advance.
/r/django
https://redd.it/1i7ybxu
Hey everyone. I'm currently on the lookout for a Django-related internship and wanted to ask for some advice. I've worked on quite a few Django projects. While I feel confident in my skills, I’m unsure how to approach finding the right internship opportunities.
For those of you who’ve landed Django internships, how did you do it? Did you find opportunities through specific job boards, open-source contributions, or cold emailing companies?
Any tips, resources, or strategies would be super helpful!
Thanks in advance.
/r/django
https://redd.it/1i7ybxu
Reddit
How do I find internships? : r/django
145K subscribers in the django community. News and links for Django developers.
Django Request Logger: Visualise request behaviour in form of graphs and charts!
/r/django
https://redd.it/1i8023s
/r/django
https://redd.it/1i8023s
deidentification - A Python tool for removing personal information from text using NLP
I'm excited to share a tool I created for automatically identifying and removing personal information from text documents using Natural Language Processing. It is both a CLI tool and an API.
https://github.com/jftuga/deidentification
https://pypi.org/project/text-deidentification
What my project does:
Identifies and replaces person names using spaCy's transformer model
Converts gender-specific pronouns to neutral alternatives
Handles possessives and hyphenated names
Offers HTML output with color-coded replacements
Target Audience:
This is aimed at production use.
Comparison:
I have not found another open-source tool that performs the same task. If you happen to know of one, please share it.
**Technical highlights:**
* Uses spaCy's transformer model for accurate Named Entity Recognition
* Handles Unicode variants and mixed encodings intelligently
* Caches metadata for quick reprocessing
Here's a quick example:
Input: John Smith's report was excellent. He clearly understands the topic.
Output: [PERSON]'s report was excellent. HE/SHE clearly understands the topic.
This was a fun project to work on - especially solving the challenge of maintaining correct character positions during replacements. The backwards processing approach was a neat solution to avoid recalculating positions after each replacement.
Check out the deidentification GitHub repo for more details and examples. I also wrote a blog post which goes into more details.
/r/Python
https://redd.it/1i8377d
I'm excited to share a tool I created for automatically identifying and removing personal information from text documents using Natural Language Processing. It is both a CLI tool and an API.
https://github.com/jftuga/deidentification
https://pypi.org/project/text-deidentification
What my project does:
Identifies and replaces person names using spaCy's transformer model
Converts gender-specific pronouns to neutral alternatives
Handles possessives and hyphenated names
Offers HTML output with color-coded replacements
Target Audience:
This is aimed at production use.
Comparison:
I have not found another open-source tool that performs the same task. If you happen to know of one, please share it.
**Technical highlights:**
* Uses spaCy's transformer model for accurate Named Entity Recognition
* Handles Unicode variants and mixed encodings intelligently
* Caches metadata for quick reprocessing
Here's a quick example:
Input: John Smith's report was excellent. He clearly understands the topic.
Output: [PERSON]'s report was excellent. HE/SHE clearly understands the topic.
This was a fun project to work on - especially solving the challenge of maintaining correct character positions during replacements. The backwards processing approach was a neat solution to avoid recalculating positions after each replacement.
Check out the deidentification GitHub repo for more details and examples. I also wrote a blog post which goes into more details.
/r/Python
https://redd.it/1i8377d
GitHub
GitHub - jftuga/deidentification: Deidentify people's names and gender specific pronouns
Deidentify people's names and gender specific pronouns - jftuga/deidentification
Rotate refresh tokens in JWT
Hi. If anyone has worked with JWT tokens where rotate refresh tokens is set to True, can you please explain how rotation works?
For example, below is my simple JWT settings.
ACCESSTOKENLIFETIME": timedelta(minutes=5), "REFRESHTOKENLIFETIME": timedelta(days=1), "ROTATEREFRESHTOKENS": True, "BLACKLISTAFTERROTATION": True.
Here’s how I think it works:
1. when the access token expires after 5 minutes, user requests a new access token using the refresh token (let's call it RT1) .
2. Along with the access token, a new refresh token (RT2) is sent to the user. RT1 is invalidated/blacklisted.
3. when again this new access token expires after 5 minutes, RT2 is used for requesting the new access token.
I believe I have understood the process correctly so far.
My question is, what is the validity of RT2? Is it 1 day from the time RT2 was issued or 1 day from the time RT1 was issued?
If it’s the former, then rotation keeps happening, and the user will remain logged in until they explicitly log out of the application. Am I right? If yes, then specifying a 1-day validity for the refresh token would serve no purpose.
If it's the latter, then the subsequent refresh tokens after RT1 will not have 1 day validity.
/r/django
https://redd.it/1i87gal
Hi. If anyone has worked with JWT tokens where rotate refresh tokens is set to True, can you please explain how rotation works?
For example, below is my simple JWT settings.
ACCESSTOKENLIFETIME": timedelta(minutes=5), "REFRESHTOKENLIFETIME": timedelta(days=1), "ROTATEREFRESHTOKENS": True, "BLACKLISTAFTERROTATION": True.
Here’s how I think it works:
1. when the access token expires after 5 minutes, user requests a new access token using the refresh token (let's call it RT1) .
2. Along with the access token, a new refresh token (RT2) is sent to the user. RT1 is invalidated/blacklisted.
3. when again this new access token expires after 5 minutes, RT2 is used for requesting the new access token.
I believe I have understood the process correctly so far.
My question is, what is the validity of RT2? Is it 1 day from the time RT2 was issued or 1 day from the time RT1 was issued?
If it’s the former, then rotation keeps happening, and the user will remain logged in until they explicitly log out of the application. Am I right? If yes, then specifying a 1-day validity for the refresh token would serve no purpose.
If it's the latter, then the subsequent refresh tokens after RT1 will not have 1 day validity.
/r/django
https://redd.it/1i87gal
Reddit
Rotate refresh tokens in JWT : r/django
145K subscribers in the django community. News and links for Django developers.
Implementing Graceful Shutdown in a Flask Application with Gunicorn and Multiprocessing
I need to implement graceful shutdown in an application where there are two Flask servers (running on different ports) and a shared multiprocessing setup.
Assume Server 1 handles the actual API endpoints, while Server 2 collects metrics and has an endpoint for that. Here's the mock setup I’m working with:
import multiprocessing as mp
import os
import signal
import time
from typing import Dict
from flask import Flask, Response
from gunicorn.app.base import BaseApplication
from gunicorn.arbiter import Arbiter
import logging
LOGGER = logging.getLogger(name)
def numberofworkers():
return mp.cpucount() * 2 + 1
def handlerapp():
app = Flask(name)
u/app.route("/", methods="GET")
def index():
return "Hello, World!"
/r/flask
https://redd.it/1i8agvr
I need to implement graceful shutdown in an application where there are two Flask servers (running on different ports) and a shared multiprocessing setup.
Assume Server 1 handles the actual API endpoints, while Server 2 collects metrics and has an endpoint for that. Here's the mock setup I’m working with:
import multiprocessing as mp
import os
import signal
import time
from typing import Dict
from flask import Flask, Response
from gunicorn.app.base import BaseApplication
from gunicorn.arbiter import Arbiter
import logging
LOGGER = logging.getLogger(name)
def numberofworkers():
return mp.cpucount() * 2 + 1
def handlerapp():
app = Flask(name)
u/app.route("/", methods="GET")
def index():
return "Hello, World!"
/r/flask
https://redd.it/1i8agvr
Reddit
From the flask community on Reddit
Explore this post and more from the flask community