Why does the allowedmethods() function return all http methods even though only get is implemented?
I have a view being inherited by APIView and I have only implemented the GET method in it. But when I call ClassInstance._allowed_methods() I get list of all the HTTP methods even though they are not implemented. When I hit that API with a POST request I get a not allowed error. How could it be?
/r/djangolearning
https://redd.it/1hcn9ug
I have a view being inherited by APIView and I have only implemented the GET method in it. But when I call ClassInstance._allowed_methods() I get list of all the HTTP methods even though they are not implemented. When I hit that API with a POST request I get a not allowed error. How could it be?
/r/djangolearning
https://redd.it/1hcn9ug
Reddit
[deleted by user] : r/djangolearning
29K subscribers in the djangolearning community. A group dedicated to learning Django, a Python web framework.
ER Diagrams in Mermaid
Does anyone know of a way to export Django models to Mermaid UML?
/r/django
https://redd.it/1hczo8d
Does anyone know of a way to export Django models to Mermaid UML?
/r/django
https://redd.it/1hczo8d
Reddit
From the django community on Reddit
Explore this post and more from the django community
DRF docs
I noticed the docs for DRF aren't really detailed. I've learnt a lot of what I can do within it from breaking stuff and asking AI or SOF. I was wondering if there are more detailed articles on it or parts of it like views and generic views
/r/django
https://redd.it/1hcxkyv
I noticed the docs for DRF aren't really detailed. I've learnt a lot of what I can do within it from breaking stuff and asking AI or SOF. I was wondering if there are more detailed articles on it or parts of it like views and generic views
/r/django
https://redd.it/1hcxkyv
Reddit
From the django community on Reddit: DRF docs
Posted by WayAndMeans01 - 9 votes and 5 comments
Suggestions
Hi,
I am proposing Django with python backend over springboot with java and have been getting lot of pushback as front end is angular and one of the concern is regarding the pagination in Django app.In springboot with jpa we have the paging and sorting repo which provide standard way to fetch items for subsequent page loads.
Is there a similar standard way for Django apps? Like we are using Oracle database and wanted to know if there was a standard way to implement pagination for a Django app with angular frontend?
Thanks
/r/django
https://redd.it/1hd0y74
Hi,
I am proposing Django with python backend over springboot with java and have been getting lot of pushback as front end is angular and one of the concern is regarding the pagination in Django app.In springboot with jpa we have the paging and sorting repo which provide standard way to fetch items for subsequent page loads.
Is there a similar standard way for Django apps? Like we are using Oracle database and wanted to know if there was a standard way to implement pagination for a Django app with angular frontend?
Thanks
/r/django
https://redd.it/1hd0y74
Reddit
From the django community on Reddit
Explore this post and more from the django community
Friday Daily Thread: r/Python Meta and Free-Talk Fridays
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1hcz7n3
# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️
Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!
## How it Works:
1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.
## Guidelines:
All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.
## Example Topics:
1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.
Let's keep the conversation going. Happy discussing! 🌟
/r/Python
https://redd.it/1hcz7n3
Redditinc
Reddit Rules
Reddit Rules - Reddit
Getting 302 Error When Uploading Document to S3 Bucket via Django Admin Panel
Hey everyone,
I'm working on a Django project where I'm trying to upload documents via the admin panel to an S3 bucket. However, I'm consistently encountering a **302 Redirect error** during the upload process.
# Setup Details:
* **Django Version:** Django==5.1.4
* **Storage Backend:** `boto3` and django-storages
* **S3 Bucket:** Configured on AWS with correct policies (I believe).
* **Settings:**
* `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_STORAGE_BUCKET_NAME` are set correctly in [dev.py](http://dev.py) of settings folder.
* `DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'`
* **Admin Panel:** The error only occurs when trying to upload via the admin panel.
​
[13/Dec/2024 14:31:04] INFO [django.server:213 log_message] "POST /admin/core/documents/5/change/ HTTP/1.1" 302 0
[13/Dec/2024 14:31:04] INFO [django.server:213 log_message] "GET /admin/core/documents/ HTTP/1.1" 200 31656
[13/Dec/2024 14:31:05] INFO [django.server:213 log_message] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
I tried uploading document through basic python noscript, I am able to upload it means credentials and other AWS settings are correctly configured.
import boto3
s3 = boto3.client(
's3',
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
region_name=region_name
)
/r/django
https://redd.it/1hd8j5x
Hey everyone,
I'm working on a Django project where I'm trying to upload documents via the admin panel to an S3 bucket. However, I'm consistently encountering a **302 Redirect error** during the upload process.
# Setup Details:
* **Django Version:** Django==5.1.4
* **Storage Backend:** `boto3` and django-storages
* **S3 Bucket:** Configured on AWS with correct policies (I believe).
* **Settings:**
* `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_STORAGE_BUCKET_NAME` are set correctly in [dev.py](http://dev.py) of settings folder.
* `DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'`
* **Admin Panel:** The error only occurs when trying to upload via the admin panel.
​
[13/Dec/2024 14:31:04] INFO [django.server:213 log_message] "POST /admin/core/documents/5/change/ HTTP/1.1" 302 0
[13/Dec/2024 14:31:04] INFO [django.server:213 log_message] "GET /admin/core/documents/ HTTP/1.1" 200 31656
[13/Dec/2024 14:31:05] INFO [django.server:213 log_message] "GET /admin/jsi18n/ HTTP/1.1" 200 3342
I tried uploading document through basic python noscript, I am able to upload it means credentials and other AWS settings are correctly configured.
import boto3
s3 = boto3.client(
's3',
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
region_name=region_name
)
/r/django
https://redd.it/1hd8j5x
Is full stack django or full stack fastapi better startup web apps?
Wanting to build mvp for idea I have, Python has been my first language of choice. Need to have ability for rapid development but scale and performance is priority.
/r/Python
https://redd.it/1hd3vvm
Wanting to build mvp for idea I have, Python has been my first language of choice. Need to have ability for rapid development but scale and performance is priority.
/r/Python
https://redd.it/1hd3vvm
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Connecting frontend and backend
Hey my friends....
I am new to django....
My teacher gave me a group project
Where i have to connect frontend with backend
How to do it with django?
I am still new to this but my
Time is short...
Can anyone help me with a video or
Explanation text
/r/django
https://redd.it/1hd8fc2
Hey my friends....
I am new to django....
My teacher gave me a group project
Where i have to connect frontend with backend
How to do it with django?
I am still new to this but my
Time is short...
Can anyone help me with a video or
Explanation text
/r/django
https://redd.it/1hd8fc2
Reddit
From the django community on Reddit
Explore this post and more from the django community
I created Musync - a python CLI tool for syncing playlists between music streaming services
Hi r/Python \- a couple of months ago decided to try out Youtube Music as a long time Spotify user. I ended up really liking it, but was hesitant to fully make the switch for fear of losing all of my playlists, followed artists, liked songs etc. So I decided to create Musync.
Link to source code
# What it does
Musync allows you sync your own user-created playlists, followed playlists and followed artists from one streaming service to another in a single command e.g.
# Target Audience
Spotify users interested in trying out Youtube Music (or vice versa).
Youtube Music users who want to share playlists with Spotify users (or vice versa).
# Quickstart
# Installation
Using pip:
pip install pymusync
Using pipx:
pipx install pymusync
You can verify the installation worked and see a list of commands by running:
musync --help
For more details on how to use, see the README. Feedback welcome!
/r/Python
https://redd.it/1hdg7v8
Hi r/Python \- a couple of months ago decided to try out Youtube Music as a long time Spotify user. I ended up really liking it, but was hesitant to fully make the switch for fear of losing all of my playlists, followed artists, liked songs etc. So I decided to create Musync.
Link to source code
# What it does
Musync allows you sync your own user-created playlists, followed playlists and followed artists from one streaming service to another in a single command e.g.
musync unisync --source spotify --destination youtube# Target Audience
Spotify users interested in trying out Youtube Music (or vice versa).
Youtube Music users who want to share playlists with Spotify users (or vice versa).
# Quickstart
# Installation
Using pip:
pip install pymusync
Using pipx:
pipx install pymusync
You can verify the installation worked and see a list of commands by running:
musync --help
For more details on how to use, see the README. Feedback welcome!
/r/Python
https://redd.it/1hdg7v8
GitHub
GitHub - devitt94/musync: A simple python CLI tool for syncing user data across music streaming services.
A simple python CLI tool for syncing user data across music streaming services. - devitt94/musync
Need Python contributors for an open-source top-down survival game with rogue lite/like elements.
If anyone is interested, you can contribute or download the source code here Poppadomus/pygameTDS
(yes, I know you shouldn't make games in python).
/r/Python
https://redd.it/1hd3pnu
If anyone is interested, you can contribute or download the source code here Poppadomus/pygameTDS
(yes, I know you shouldn't make games in python).
/r/Python
https://redd.it/1hd3pnu
GitHub
GitHub - Poppadomus/pygameTDS: PyGameTDS is an open source, 2D top-down shooter engine with roguelite elements.
PyGameTDS is an open source, 2D top-down shooter engine with roguelite elements. - Poppadomus/pygameTDS
I need help importing JS packages in Django projects
I did my research and apparently i need webpack, but none of the tutorials i found were really helpful. any advice?
/r/django
https://redd.it/1hdouc4
I did my research and apparently i need webpack, but none of the tutorials i found were really helpful. any advice?
/r/django
https://redd.it/1hdouc4
Reddit
From the django community on Reddit
Explore this post and more from the django community
Is there a way to update session variables from a generator function()?
I'm building a web app that streams content from the Claude streaming API to the frontend UI. Conceptually like a chatbot.
I've used a generator() function for this. My issue is that I'm unable to update any session variables with this function. I need to save the API response to the session once response is complete.
**But I'm unable to update session variables within a generator.** So instead I tried doing this modification within a call\_on\_close with a copy\_current\_request\_context decorator. But that also didn't work.
**How can I update a session variable based on a value that is generated with a Flask generator function?**
with anthropic.client.messages.stream(
...
) as stream:
for text in stream.text_stream:
/r/flask
https://redd.it/1hdm1f4
I'm building a web app that streams content from the Claude streaming API to the frontend UI. Conceptually like a chatbot.
I've used a generator() function for this. My issue is that I'm unable to update any session variables with this function. I need to save the API response to the session once response is complete.
**But I'm unable to update session variables within a generator.** So instead I tried doing this modification within a call\_on\_close with a copy\_current\_request\_context decorator. But that also didn't work.
**How can I update a session variable based on a value that is generated with a Flask generator function?**
with anthropic.client.messages.stream(
...
) as stream:
for text in stream.text_stream:
/r/flask
https://redd.it/1hdm1f4
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1hdq183
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1hdq183
Django and SOLID principles
I'm studying traditional software development best practices and also trying to tie up with what I do at work (building APIs).
If I take a look at Django's Model class, it doesn't seem to me to follow S of SOLID (it has validate() and save() methods, which means it has too many responsibilites apart from just defining model). Do you agree with me here? It seems that the framework is not written to follow SOLID. Does it follow some kind of other philosophy? It's hard for me to understand what's best practice when even the giant in the industry (e.g. Django) doesn't follow it...
/r/django
https://redd.it/1hdidm0
I'm studying traditional software development best practices and also trying to tie up with what I do at work (building APIs).
If I take a look at Django's Model class, it doesn't seem to me to follow S of SOLID (it has validate() and save() methods, which means it has too many responsibilites apart from just defining model). Do you agree with me here? It seems that the framework is not written to follow SOLID. Does it follow some kind of other philosophy? It's hard for me to understand what's best practice when even the giant in the industry (e.g. Django) doesn't follow it...
/r/django
https://redd.it/1hdidm0
Reddit
From the django community on Reddit
Explore this post and more from the django community
I am sharing Python & Data Science courses on YouTube
Hello, I wanted to share that I am sharing free courses and projects on my YouTube Channel. I have more than 200 videos and I created playlists for Python and Data Science. I am leaving the playlist link below, have a great day!
Python Data Science Full Courses & Projects -> https://youtube.com/playlist?list=PLTsu3dft3CWiow7L7WrCd27ohlra\_5PGH&si=6WUpVwXeAKEs4tB6
Python Tutorials -> https://youtube.com/playlist?list=PLTsu3dft3CWgJrlcs\_IO1eif7myukPPKJ&si=fYIz2RLJV1dC6nT5
/r/Python
https://redd.it/1hdygzz
Hello, I wanted to share that I am sharing free courses and projects on my YouTube Channel. I have more than 200 videos and I created playlists for Python and Data Science. I am leaving the playlist link below, have a great day!
Python Data Science Full Courses & Projects -> https://youtube.com/playlist?list=PLTsu3dft3CWiow7L7WrCd27ohlra\_5PGH&si=6WUpVwXeAKEs4tB6
Python Tutorials -> https://youtube.com/playlist?list=PLTsu3dft3CWgJrlcs\_IO1eif7myukPPKJ&si=fYIz2RLJV1dC6nT5
/r/Python
https://redd.it/1hdygzz
YouTube
Data Science Full Courses & Projects
Check out the "Data Science Full Courses & Projects" playlist, your go-to spot for diving deep into Data Analysis, Data Visualization, and Machine Learning. ...
How to navigate through file tree using Jinja's `url_for`?
I apologize if I'm asking at a slightly unrelated subreddit. I'll delete the post of if suggested.
Hi all, I'm having trouble making my web app to read static `.css` using jinja's `url_for()`. My backend is Flask but I think Jinja is commonly used too in Django so I'm hoping to find more suggestions here.
The HTML fails to read this stylesheet. I'm going describe how the project files are structured followed by the content of each files.
**Project structure**
Below is the file structure tree:
coolest_app/
├── __init__.py
└── pages/
├── __init__.py
├── templates/
│ ├── base.html
└── static/
└── styles/
└── base.cssmain.py
**File contents**
There are in total 5 files in total within this project. But, I'm only giving the content of 4 files only since the `.css` file content is irrelevant.
a. [`main.py`](http://main.py) file
/r/django
https://redd.it/1he3ne1
I apologize if I'm asking at a slightly unrelated subreddit. I'll delete the post of if suggested.
Hi all, I'm having trouble making my web app to read static `.css` using jinja's `url_for()`. My backend is Flask but I think Jinja is commonly used too in Django so I'm hoping to find more suggestions here.
The HTML fails to read this stylesheet. I'm going describe how the project files are structured followed by the content of each files.
**Project structure**
Below is the file structure tree:
coolest_app/
├── __init__.py
└── pages/
├── __init__.py
├── templates/
│ ├── base.html
└── static/
└── styles/
└── base.cssmain.py
**File contents**
There are in total 5 files in total within this project. But, I'm only giving the content of 4 files only since the `.css` file content is irrelevant.
a. [`main.py`](http://main.py) file
/r/django
https://redd.it/1he3ne1
Reddit
From the django community on Reddit
Explore this post and more from the django community
Imposter Syndrome
hello everyone!
i hope you're all doing well. as a final year computer science student and aspiring backend engineer, i've been working with django and drf for a while now. however, i've reached a point where i feel stuck and unsure about my next steps.
if anyone has advice, project ideas, or knows of open-source projects i can contribute to, i'd really appreciate it. any guidance on improving my skills would be incredibly helpful.
thank you all in advance!
/r/django
https://redd.it/1he50zz
hello everyone!
i hope you're all doing well. as a final year computer science student and aspiring backend engineer, i've been working with django and drf for a while now. however, i've reached a point where i feel stuck and unsure about my next steps.
if anyone has advice, project ideas, or knows of open-source projects i can contribute to, i'd really appreciate it. any guidance on improving my skills would be incredibly helpful.
thank you all in advance!
/r/django
https://redd.it/1he50zz
Reddit
From the django community on Reddit
Explore this post and more from the django community
Feedback - Cyberbro - Analyze observable (IP, hash, domain) with ease - (CTI Cybersecurity project)
Hello there,
I am a junior cybersecurity engineer and I am developing an open source project in Python Flask and HTML.
Any feedback would be appreciated on the code structure, even if it actually works I think there are many improvements to be made (OOP, classes, I/O, MultiThread, MultiProcessing?).
I would be really glad to have a real Python programmer giving me even small pieces of advice to improve the project.
This project is a simple application that extracts your IoCs from garbage input (using regex) and checks their reputation using multiple services.
It is mainly Inspired by existing projects Cybergordon and IntelOwl.
I am convinced that this project is useful for SOC analysts or CTI professionnals (I use it daily for my job, and my company took interest for it).
**Features**
* **Effortless Input Handling**: Paste raw logs, IoCs, or fanged IoCs, and let our regex parser do the rest.
* **Multi-Service Reputation Checks**: Verify observables (IP, hash, domain, URL) across multiple services like VirusTotal, AbuseIPDB, IPInfo, Spur\[.\]us, IP Quality Score, MDE, Google Safe Browsing, Shodan, Abusix, Phishtank, ThreatFox, Github, Google...
* **Detailed Reports**: Generate comprehensive reports with advanced search and filter options.
* **High Performance**: Leverage multithreading for faster processing.
* **Automated Observable Pivoting**: Automatically pivot on domains, URL and
/r/Python
https://redd.it/1he1r6i
Hello there,
I am a junior cybersecurity engineer and I am developing an open source project in Python Flask and HTML.
Any feedback would be appreciated on the code structure, even if it actually works I think there are many improvements to be made (OOP, classes, I/O, MultiThread, MultiProcessing?).
I would be really glad to have a real Python programmer giving me even small pieces of advice to improve the project.
This project is a simple application that extracts your IoCs from garbage input (using regex) and checks their reputation using multiple services.
It is mainly Inspired by existing projects Cybergordon and IntelOwl.
I am convinced that this project is useful for SOC analysts or CTI professionnals (I use it daily for my job, and my company took interest for it).
**Features**
* **Effortless Input Handling**: Paste raw logs, IoCs, or fanged IoCs, and let our regex parser do the rest.
* **Multi-Service Reputation Checks**: Verify observables (IP, hash, domain, URL) across multiple services like VirusTotal, AbuseIPDB, IPInfo, Spur\[.\]us, IP Quality Score, MDE, Google Safe Browsing, Shodan, Abusix, Phishtank, ThreatFox, Github, Google...
* **Detailed Reports**: Generate comprehensive reports with advanced search and filter options.
* **High Performance**: Leverage multithreading for faster processing.
* **Automated Observable Pivoting**: Automatically pivot on domains, URL and
/r/Python
https://redd.it/1he1r6i
Reddit
From the Python community on Reddit: Feedback - Cyberbro - Analyze observable (IP, hash, domain) with ease - (CTI Cybersecurity…
Explore this post and more from the Python community
Backend development
Which one study for backend development python Django can be useful??
/r/djangolearning
https://redd.it/1hdwjhl
Which one study for backend development python Django can be useful??
/r/djangolearning
https://redd.it/1hdwjhl
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Speeds up the query of a database with a lot of data
Hello everyone
I am working on an Oauth2 project App 1, one has a model company with 20 fields, when the user creates for example 20,000 company, when I created App 2 which can introspect App 1 and the model company , it takes 5 minutes for my request to return the companies to me and create or update them if they exist, I however used blinkcreate and blinkupdate when it is a new company, the others I update company by company is where the query takes a lot of time...
I also tried to overwrite the data received on the existing one, but my database or the Django ORM refuses because the foreight key already exists
Do you have any solutions when I update a list to do one by one and come update all at once?
Thanks to you
/r/django
https://redd.it/1he5055
Hello everyone
I am working on an Oauth2 project App 1, one has a model company with 20 fields, when the user creates for example 20,000 company, when I created App 2 which can introspect App 1 and the model company , it takes 5 minutes for my request to return the companies to me and create or update them if they exist, I however used blinkcreate and blinkupdate when it is a new company, the others I update company by company is where the query takes a lot of time...
I also tried to overwrite the data received on the existing one, but my database or the Django ORM refuses because the foreight key already exists
Do you have any solutions when I update a list to do one by one and come update all at once?
Thanks to you
/r/django
https://redd.it/1he5055
Reddit
From the django community on Reddit
Explore this post and more from the django community