Question about storing audio files
I am creating a web application where you can put music files inside that are added to a list where you can start, delete and eventually download in the future all your files that you have put. Now, what I was thinking of doing was using a database that keeps the path where each user's files are (divided into folders and subfolders; example: songs/Amanda56/song.mp3). I was thinking of creating these in urls that are added dynamically over time (example: when a user registers with the nickname Giorgio192, a url called: https:/www.mysite.com/storage/songs/Giorgio192/ will be created. The songs url already exists, the one that will be added is Giorgio192 (his username therefore). When Giorgio192 adds a new song to his list, this song will be stored in songs/Giorgio192/song.mp3 while the url that is used to extract the songs from there will be saved in my database. Is this method strange? Would it slow down my site a lot over time? If so, how? Is there a way to do what I want?
/r/flask
https://redd.it/1hb6fp0
I am creating a web application where you can put music files inside that are added to a list where you can start, delete and eventually download in the future all your files that you have put. Now, what I was thinking of doing was using a database that keeps the path where each user's files are (divided into folders and subfolders; example: songs/Amanda56/song.mp3). I was thinking of creating these in urls that are added dynamically over time (example: when a user registers with the nickname Giorgio192, a url called: https:/www.mysite.com/storage/songs/Giorgio192/ will be created. The songs url already exists, the one that will be added is Giorgio192 (his username therefore). When Giorgio192 adds a new song to his list, this song will be stored in songs/Giorgio192/song.mp3 while the url that is used to extract the songs from there will be saved in my database. Is this method strange? Would it slow down my site a lot over time? If so, how? Is there a way to do what I want?
/r/flask
https://redd.it/1hb6fp0
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
D From Unemployment to Lisp: Running GPT-2 on a Teen's Deep Learning Compiler
A couple months ago I found myself unemployed, uncertain about what to do next. I wanted to learn more about deep learning, but from a systems prespective. Coming from Andrew's Ng course on supervised learning, I was eager to learn more about how deep learning frameworks (or deep learning compilers) like Pytorch or Tinygrad.
I started to poke around Tinygrad, learning from the tutorials I found online, and I found it fascinating because it was an actual compiler, it took conventional python code and translated them into an Abstract Syntax Tree that was parsed into UOps and ScheduleItems, to finally have a codegen layer. While the design was interesting, the code was hard to read.
That's when I stumbled across something completly unexpected, A deep learning compiler built on Common Lisp, maintained by a Japanese 18-year-old during his gap year. And currently we have acomplished something great, it can run gpt2!
For now, it just generates C-kernels, but in the future we would like to support cuda codegen as well as many other features, and serve as a learning tool for anyone who would like to get to work on deep learning compilers in Common Lisp.
This is an open source project and anyone
/r/MachineLearning
https://redd.it/1hb7v5h
A couple months ago I found myself unemployed, uncertain about what to do next. I wanted to learn more about deep learning, but from a systems prespective. Coming from Andrew's Ng course on supervised learning, I was eager to learn more about how deep learning frameworks (or deep learning compilers) like Pytorch or Tinygrad.
I started to poke around Tinygrad, learning from the tutorials I found online, and I found it fascinating because it was an actual compiler, it took conventional python code and translated them into an Abstract Syntax Tree that was parsed into UOps and ScheduleItems, to finally have a codegen layer. While the design was interesting, the code was hard to read.
That's when I stumbled across something completly unexpected, A deep learning compiler built on Common Lisp, maintained by a Japanese 18-year-old during his gap year. And currently we have acomplished something great, it can run gpt2!
For now, it just generates C-kernels, but in the future we would like to support cuda codegen as well as many other features, and serve as a learning tool for anyone who would like to get to work on deep learning compilers in Common Lisp.
This is an open source project and anyone
/r/MachineLearning
https://redd.it/1hb7v5h
Reddit
From the MachineLearning community on Reddit: [D] From Unemployment to Lisp: Running GPT-2 on a Teen's Deep Learning Compiler
Explore this post and more from the MachineLearning community
D Why are the Stella embedding models so much smaller than other models of similar quality?
On the MTEB Leaderboard,
What is the secret sauce here? Alternatively, what is the catch? There is no paper yet. Anyone know details?
/r/MachineLearning
https://redd.it/1hbkww5
On the MTEB Leaderboard,
stella_en_v5 is currently ranked 3rd overall, while using one fifth the memory of all non-Stella models in the top 10.stella_en_400M_v5 is ranked 10th, while using 15-20 times less memory than the models ranked near it. This appears to be relatively consistent across several subtasks of the benchmark (for English).What is the secret sauce here? Alternatively, what is the catch? There is no paper yet. Anyone know details?
/r/MachineLearning
https://redd.it/1hbkww5
huggingface.co
MTEB Leaderboard - a Hugging Face Space by mteb
Select and customize benchmarks for different tasks like image-text, domain-specific, and language-specific evaluations. Choose from multilingual options, specific languages, and various domains in...
Did an open source tool for code exploration
# Denoscription
Treeline is a code analysis and visualization tool designed to help developers understand the quality and structure of their Python codebases. It does some complexity metrics, detects code smells, and generates an interactive HTML-based visualization for relatively easy exploration. I hope it will give developers some insights into architectural dependencies, complexity hotspots, and maintainability issues.
# Links
* [https://github.com/duriantaco/treeline](https://github.com/duriantaco/treeline)
* [https://pypi.org/project/treeline/](https://pypi.org/project/treeline/)
# What My Project Does
* **Dependency Analysis**: Identifies which modules import others, which classes belong to which modules, and which functions call which, creating a complete dependency graph.
* **Metrics Computation**: Calculates cyclomatic complexity, cognitive complexity, maintainability index, function length, and code smell occurrences.
* **Visualization**: Renders an interactive HTML report using D3.js, where each node represents a module, class, or function. You can hover over nodes to see detailed metrics, search for specific elements.
* **Quality Reporting**: Produces Markdown and HTML reports summarizing complexity hotspots.
# Target Audience
* Anyone using Python
# Extra Details
Started of as a simple ASCII tree generator. Promised to add more stuff so here i am.
# Conclusion
Hopefully you guys will find it useful. If you think it's a stupid idea or ways to improve, do let me know too. I'm open to criticisms and constructive feedback. If you find any bugs
/r/Python
https://redd.it/1hbnasw
# Denoscription
Treeline is a code analysis and visualization tool designed to help developers understand the quality and structure of their Python codebases. It does some complexity metrics, detects code smells, and generates an interactive HTML-based visualization for relatively easy exploration. I hope it will give developers some insights into architectural dependencies, complexity hotspots, and maintainability issues.
# Links
* [https://github.com/duriantaco/treeline](https://github.com/duriantaco/treeline)
* [https://pypi.org/project/treeline/](https://pypi.org/project/treeline/)
# What My Project Does
* **Dependency Analysis**: Identifies which modules import others, which classes belong to which modules, and which functions call which, creating a complete dependency graph.
* **Metrics Computation**: Calculates cyclomatic complexity, cognitive complexity, maintainability index, function length, and code smell occurrences.
* **Visualization**: Renders an interactive HTML report using D3.js, where each node represents a module, class, or function. You can hover over nodes to see detailed metrics, search for specific elements.
* **Quality Reporting**: Produces Markdown and HTML reports summarizing complexity hotspots.
# Target Audience
* Anyone using Python
# Extra Details
Started of as a simple ASCII tree generator. Promised to add more stuff so here i am.
# Conclusion
Hopefully you guys will find it useful. If you think it's a stupid idea or ways to improve, do let me know too. I'm open to criticisms and constructive feedback. If you find any bugs
/r/Python
https://redd.it/1hbnasw
GitHub
GitHub - duriantaco/treeline: Directory analysis that can create ASCII tree representations as well as light code quality analysis…
Directory analysis that can create ASCII tree representations as well as light code quality analysis as well as architectural flow - GitHub - duriantaco/treeline: Directory analysis that can creat...
Django Web Application Hosted on LAN
Is it possible to set up a centralized application server that hosts a Django web app and a local database, allowing clients on separate computers to access the app for CRUD operations (e.g., managing mail/blacklists) while storing updates locally? The server would also communicate with a ROS2 system on another computer (running AI models and managing daily logs) and optionally sync data to the cloud. Are there any potential challenges or considerations with this architecture?
/r/django
https://redd.it/1hbnynb
Is it possible to set up a centralized application server that hosts a Django web app and a local database, allowing clients on separate computers to access the app for CRUD operations (e.g., managing mail/blacklists) while storing updates locally? The server would also communicate with a ROS2 system on another computer (running AI models and managing daily logs) and optionally sync data to the cloud. Are there any potential challenges or considerations with this architecture?
/r/django
https://redd.it/1hbnynb
Reddit
From the django community on Reddit
Explore this post and more from the django community
Nodriver - The next step in web scraping
Hey guys! Scraping is something we've all needed at some point, whether for personal or professional reasons. But nowadays I feel like I get blocked immediately if I go to any website and tbh I don't want to setup complex patches and go through all that stuff for like a tiny thing. Nodriver solved this problem for me.
Here's an article I wrote about getting started with nodriver and how it faces up with the competition - https://www.hyperbrowser.ai/blog/nodriver_:_The_next_step_in_web_automation
/r/Python
https://redd.it/1hbea0n
Hey guys! Scraping is something we've all needed at some point, whether for personal or professional reasons. But nowadays I feel like I get blocked immediately if I go to any website and tbh I don't want to setup complex patches and go through all that stuff for like a tiny thing. Nodriver solved this problem for me.
Here's an article I wrote about getting started with nodriver and how it faces up with the competition - https://www.hyperbrowser.ai/blog/nodriver_:_The_next_step_in_web_automation
/r/Python
https://redd.it/1hbea0n
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Proof of PCAP Certification?
For those of you who have taken (and passed) the PCAP, did you receive anything other than the paper printout after the exam? (I know the PCAP isn't particularly useful, but my company offered me a 3% raise if I passed it so...) I'm just wondering if I should expect an email with some official looking certification or if I should just show the exam printout to my company.
/r/Python
https://redd.it/1hbq85s
For those of you who have taken (and passed) the PCAP, did you receive anything other than the paper printout after the exam? (I know the PCAP isn't particularly useful, but my company offered me a 3% raise if I passed it so...) I'm just wondering if I should expect an email with some official looking certification or if I should just show the exam printout to my company.
/r/Python
https://redd.it/1hbq85s
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
The hand-picked selection of the best Python libraries and tools of 2024 – 10th edition!
Hello Python community!
We're excited to share our milestone 10th edition of the Top Python Libraries and tools, continuing our tradition of exploring the Python ecosystem for the most innovative developments of the year.
Based on community feedback (thank you!), we've made a significant change this year: we've split our selections into General Use and AI/ML/Data categories, ensuring something valuable for every Python developer. Our team has carefully reviewed hundreds of libraries to bring you the most impactful tools of 2024.
Read the full article with detailed analysis here: https://tryolabs.com/blog/top-python-libraries-2024
Here's a preview of our top picks:
General Use:
1. **uv** — Lightning-fast Python package manager in Rust
2. **Tach** — Tame module dependencies in large projects
3. **Whenever** — Intuitive datetime library for Python
4. **WAT** — Powerful object inspection tool
5. **peepDB** — Peek at your database effortlessly
6. **Crawlee** — Modern web scraping toolkit
7. **PGQueuer** — PostgreSQL-powered job queue
8. **streamable** — Elegant stream processing for iterables
9. **RightTyper** — Generate static types automatically
10. **Rio** — Modern web apps in pure Python
AI / ML / Data:
1. **BAML** — Domain-specific language for LLMs
2. **marimo** — Notebooks reimagined
3. **OpenHands** — Powerful agent for code development
4. **Crawl4AI** — Intelligent web crawling for AI
5. **LitServe** — Effortless AI model serving
6. **Mirascope** — Unified LLM
/r/Python
https://redd.it/1hbs4t8
Hello Python community!
We're excited to share our milestone 10th edition of the Top Python Libraries and tools, continuing our tradition of exploring the Python ecosystem for the most innovative developments of the year.
Based on community feedback (thank you!), we've made a significant change this year: we've split our selections into General Use and AI/ML/Data categories, ensuring something valuable for every Python developer. Our team has carefully reviewed hundreds of libraries to bring you the most impactful tools of 2024.
Read the full article with detailed analysis here: https://tryolabs.com/blog/top-python-libraries-2024
Here's a preview of our top picks:
General Use:
1. **uv** — Lightning-fast Python package manager in Rust
2. **Tach** — Tame module dependencies in large projects
3. **Whenever** — Intuitive datetime library for Python
4. **WAT** — Powerful object inspection tool
5. **peepDB** — Peek at your database effortlessly
6. **Crawlee** — Modern web scraping toolkit
7. **PGQueuer** — PostgreSQL-powered job queue
8. **streamable** — Elegant stream processing for iterables
9. **RightTyper** — Generate static types automatically
10. **Rio** — Modern web apps in pure Python
AI / ML / Data:
1. **BAML** — Domain-specific language for LLMs
2. **marimo** — Notebooks reimagined
3. **OpenHands** — Powerful agent for code development
4. **Crawl4AI** — Intelligent web crawling for AI
5. **LitServe** — Effortless AI model serving
6. **Mirascope** — Unified LLM
/r/Python
https://redd.it/1hbs4t8
Tryolabs
Top Python libraries of 2024
Dive into our 10th annual Python Libraries roundup for 2024, now featuring separate curated lists for General Use and AI / ML / Data tools. Discover this year's most innovative additions to the ecosystem!
Introducing My New Favicon Extraction Tool
## What My Project Does
I've created a tool that extracts favicons from any website. It works by parsing HTML pages, checking fallback routes for icons, and even supports inline base64-encoded images. The tool can also verify availability, guess missing icon sizes, and download the favicons for further processing. It aims to streamline favicon retrieval for web scraping, data analysis or just curious exploration.
## Links
- Source code: https://github.com/AlexMili/extractfavicon/
- Documentation: https://alexmili.github.io/extractfavicon/
## Target Audience
The project is designed for developers and data enthusiasts who work with web metadata. Whether you’re building a crawler, enhancing a web directory, or simply analyzing website branding. My intention is to maintain and improve it, making it stable and ready for production use cases.
## Comparison
While there are other favicon extraction libraries out there, many of them have become unmaintained or lack features like asynchronous support, thorough availability checks, and automatic size guessing. My project is actively maintained, built with modern Python standards, and provides a more robust, flexible solution than many existing alternatives.
/r/Python
https://redd.it/1hbtf03
## What My Project Does
I've created a tool that extracts favicons from any website. It works by parsing HTML pages, checking fallback routes for icons, and even supports inline base64-encoded images. The tool can also verify availability, guess missing icon sizes, and download the favicons for further processing. It aims to streamline favicon retrieval for web scraping, data analysis or just curious exploration.
## Links
- Source code: https://github.com/AlexMili/extractfavicon/
- Documentation: https://alexmili.github.io/extractfavicon/
## Target Audience
The project is designed for developers and data enthusiasts who work with web metadata. Whether you’re building a crawler, enhancing a web directory, or simply analyzing website branding. My intention is to maintain and improve it, making it stable and ready for production use cases.
## Comparison
While there are other favicon extraction libraries out there, many of them have become unmaintained or lack features like asynchronous support, thorough availability checks, and automatic size guessing. My project is actively maintained, built with modern Python standards, and provides a more robust, flexible solution than many existing alternatives.
/r/Python
https://redd.it/1hbtf03
How to test Flask with dummy DB
Hi, I have been making a Flask CRUD API, I am using pytest to test the models and everything that can be done without having to initialize the Flask App. However, now I really need to start testing the endpoints. I have checked https://flask.palletsprojects.com/en/stable/testing/ and I am getting a general idea on how to do so, however, I am still a bit lost on how to initialize the database and populate it during the testing. Would love any tips :)
/r/flask
https://redd.it/1hbrbb3
Hi, I have been making a Flask CRUD API, I am using pytest to test the models and everything that can be done without having to initialize the Flask App. However, now I really need to start testing the endpoints. I have checked https://flask.palletsprojects.com/en/stable/testing/ and I am getting a general idea on how to do so, however, I am still a bit lost on how to initialize the database and populate it during the testing. Would love any tips :)
/r/flask
https://redd.it/1hbrbb3
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
D Resources to get up to the speed with the state of the art evolutionary optimization
There're plenty of good books letting you get close to the state of the art in the field, on Machine Learning, and Deep Learning in particular. However, are there any good modern books on evolutionary optimization? Are there any good courses?
/r/MachineLearning
https://redd.it/1hbt986
There're plenty of good books letting you get close to the state of the art in the field, on Machine Learning, and Deep Learning in particular. However, are there any good modern books on evolutionary optimization? Are there any good courses?
/r/MachineLearning
https://redd.it/1hbt986
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
Django's built-in test client or pytest?
For testing in a Django project, what should I use Django's built-in test client or pytest?
Or what's the benefit of using one of them instead of the other one?
/r/django
https://redd.it/1hbxxi6
For testing in a Django project, what should I use Django's built-in test client or pytest?
Or what's the benefit of using one of them instead of the other one?
/r/django
https://redd.it/1hbxxi6
Reddit
From the django community on Reddit
Explore this post and more from the django community
Recommended Tutorials for Network Programming Using Django as a Beginner?
I’m a network engineer currently studying Django to build a front end for my Python noscript. I’ve started watching some video tutorials and reading through the Django documentation, but I’m still looking for resources that specifically focus on network programming or tools for beginners using Django.
Does anyone have recommendations for tutorials, video courses, or guides that might help someone in my position? Thank you
/r/django
https://redd.it/1hc2tl4
I’m a network engineer currently studying Django to build a front end for my Python noscript. I’ve started watching some video tutorials and reading through the Django documentation, but I’m still looking for resources that specifically focus on network programming or tools for beginners using Django.
Does anyone have recommendations for tutorials, video courses, or guides that might help someone in my position? Thank you
/r/django
https://redd.it/1hc2tl4
Reddit
From the django community on Reddit
Explore this post and more from the django community
Deployment
Hello, I already finished my software for my friend clinic using django and my sql for db and i want to install it on my friend laptop and it will work only locally so what’s the best way to do this ?
/r/django
https://redd.it/1hc9gzg
Hello, I already finished my software for my friend clinic using django and my sql for db and i want to install it on my friend laptop and it will work only locally so what’s the best way to do this ?
/r/django
https://redd.it/1hc9gzg
Reddit
From the django community on Reddit
Explore this post and more from the django community
Struggling to store uploaded files on the server.
from flask import Flask, render_template, session, Response, request, flash, redirect, url_for
from random import randint
import os
app = Flask(__name__)
app.secret_key = "run"
uploadfolder = 'upload_img'
extensions = {'png','jpg','jpeg','gif'}
app.config["UPLOAD_FOLDER"] = uploadfolder
def isallowed(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in extensions
@app.route("/")
def default():
return render_template("index.html")
@app.route("/uploadimg" , methods=["POST"])
def imgpicker():
file = request.files["file"]
if file and isallowed(file.filename):
if not os.path.exists(uploadfolder):
os.makedirs(uploadfolder)
/r/flask
https://redd.it/1hbv2sq
from flask import Flask, render_template, session, Response, request, flash, redirect, url_for
from random import randint
import os
app = Flask(__name__)
app.secret_key = "run"
uploadfolder = 'upload_img'
extensions = {'png','jpg','jpeg','gif'}
app.config["UPLOAD_FOLDER"] = uploadfolder
def isallowed(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in extensions
@app.route("/")
def default():
return render_template("index.html")
@app.route("/uploadimg" , methods=["POST"])
def imgpicker():
file = request.files["file"]
if file and isallowed(file.filename):
if not os.path.exists(uploadfolder):
os.makedirs(uploadfolder)
/r/flask
https://redd.it/1hbv2sq
Reddit
From the flask community on Reddit
Explore this post and more from the flask 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/1hc7z1a
# 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/1hc7z1a
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Open-source Python Uno shuffler
Hi r/Python community! I recently made an Uno shuffler program with python. You can fork it here: https://github.com/LarryEmerson12/UnoShuffler/. It simply just generates the whole Uno deck, and then shuffles it. You can shuffle it as many times as you want.
Target Audience:
You can implement it in your other projects.
Comparison:
I do not know about other projects.
If there are any issues, feel free to comment.
/r/Python
https://redd.it/1hcbfp7
Hi r/Python community! I recently made an Uno shuffler program with python. You can fork it here: https://github.com/LarryEmerson12/UnoShuffler/. It simply just generates the whole Uno deck, and then shuffles it. You can shuffle it as many times as you want.
Target Audience:
You can implement it in your other projects.
Comparison:
I do not know about other projects.
If there are any issues, feel free to comment.
/r/Python
https://redd.it/1hcbfp7
GitHub
GitHub - LarryEmerson12/UnoShuffler: A simple python noscript that returns shuffled Uno cards.
A simple python noscript that returns shuffled Uno cards. - LarryEmerson12/UnoShuffler
Why is this retrieve method incrementing the viewcount by 2 instead of 1 ? .
class ArticleViewSet(ArticleViewSetMixin, viewsets.ReadOnlyModelViewSet):
filtersetclass = ArticleFilter
permissionclasses = (AllowAny,)
queryset = Article.objects.filter(publisheddatelte=datetime.now(tz=IST))
serializerclass = ArticleSerializer
def retrieve(self, *args, **kwargs):
instance = self.getobject()
Article.objects.filter(pk=instance.pk).update(viewcount=F("viewcount") + 1)
instance.refreshfromdb()
serializer = self.getserializer(instance)
return Response(serializer.data)
Each time i send a postman request, its incrementing the view\count by 2 instead of 1 ? .
why is that ? .
I also don't have any separate signals or anything, this is the only method I have overridden.
/r/django
https://redd.it/1hcfjdz
class ArticleViewSet(ArticleViewSetMixin, viewsets.ReadOnlyModelViewSet):
filtersetclass = ArticleFilter
permissionclasses = (AllowAny,)
queryset = Article.objects.filter(publisheddatelte=datetime.now(tz=IST))
serializerclass = ArticleSerializer
def retrieve(self, *args, **kwargs):
instance = self.getobject()
Article.objects.filter(pk=instance.pk).update(viewcount=F("viewcount") + 1)
instance.refreshfromdb()
serializer = self.getserializer(instance)
return Response(serializer.data)
Each time i send a postman request, its incrementing the view\count by 2 instead of 1 ? .
why is that ? .
I also don't have any separate signals or anything, this is the only method I have overridden.
/r/django
https://redd.it/1hcfjdz
Reddit
From the django community on Reddit
Explore this post and more from the django community
Help needed: Flask not loading images in one template
https://preview.redd.it/isayd97rhd6e1.png?width=900&format=png&auto=webp&s=defc230877ba3f07585cb25cf2693309808682dd
Hello,
I'm new to Flask and having trouble with images in one of my templates (`login.html`). Images load fine when `dashboard.html` using `{{ url_for('static', filename='images/logo.jpg') }}`, but the same code doesn't work in `login.html`. Similarly, the CSS file (`/static/css/styles.css`) also doesn't load for `login.html`.
I've checked the file structure and paths, cleared my browser cache, and tried hardcoding the image paths (`/static/images/logo.jpg`), but no luck. Whenever I load the HTML page separately with the hardcoded path, it works fine.
What could be causing this inconsistency? I would appreciate any help!
**Login.html:**
<header>
<img src="/static/images/logo.jpg" alt="logo">
<!-- <img src ="{{ url_for('static', filename='/images/logo.jpg') }}"> -->
</header>
<footer>
<!-- Bottom-center motto -->
<img src="/static/images/motto.jpg" alt="motto">
</footer>
**Dashboard.html:**
<header>
<!-- <img src="{{ url_for('static', filename='images/logo.jpg') }}" alt="Logo">-->
<img src="/static/images/logo.jpg" alt="logo">
<button class="logout-btn" onclick="
window
.location.href='{{ url_for('logout') }}'">Logout</button>
/r/flask
https://redd.it/1hcg89m
https://preview.redd.it/isayd97rhd6e1.png?width=900&format=png&auto=webp&s=defc230877ba3f07585cb25cf2693309808682dd
Hello,
I'm new to Flask and having trouble with images in one of my templates (`login.html`). Images load fine when `dashboard.html` using `{{ url_for('static', filename='images/logo.jpg') }}`, but the same code doesn't work in `login.html`. Similarly, the CSS file (`/static/css/styles.css`) also doesn't load for `login.html`.
I've checked the file structure and paths, cleared my browser cache, and tried hardcoding the image paths (`/static/images/logo.jpg`), but no luck. Whenever I load the HTML page separately with the hardcoded path, it works fine.
What could be causing this inconsistency? I would appreciate any help!
**Login.html:**
<header>
<img src="/static/images/logo.jpg" alt="logo">
<!-- <img src ="{{ url_for('static', filename='/images/logo.jpg') }}"> -->
</header>
<footer>
<!-- Bottom-center motto -->
<img src="/static/images/motto.jpg" alt="motto">
</footer>
**Dashboard.html:**
<header>
<!-- <img src="{{ url_for('static', filename='images/logo.jpg') }}" alt="Logo">-->
<img src="/static/images/logo.jpg" alt="logo">
<button class="logout-btn" onclick="
window
.location.href='{{ url_for('logout') }}'">Logout</button>
/r/flask
https://redd.it/1hcg89m
Open-source Python Time-wasters
Hi r/Python community! I recently made an time waster program with python. You can fork it here: https://github.com/LarryEmerson12/TimeWasters/ It simply just shows some 0s, and then animates it. You can edit the speed at how you want.
Target Audience:
Use this when you're bored.
Comparison:
I do not know about other projects.
If there are any issues, feel free to comment.
/r/Python
https://redd.it/1hcgtrz
Hi r/Python community! I recently made an time waster program with python. You can fork it here: https://github.com/LarryEmerson12/TimeWasters/ It simply just shows some 0s, and then animates it. You can edit the speed at how you want.
Target Audience:
Use this when you're bored.
Comparison:
I do not know about other projects.
If there are any issues, feel free to comment.
/r/Python
https://redd.it/1hcgtrz
GitHub
GitHub - LarryEmerson12/TimeWasters
Contribute to LarryEmerson12/TimeWasters development by creating an account on GitHub.
How to upload files to server using django rest framework (i'm using flutter for the front end)
I'm building a user application which allows user to upload designs for saree's (basically the app is going to be used in textile industries in precise) here i stuck with the file uploading part like how to upload files which are around 2-30mb to the server using DRF.
for context the app is going to communicate with the machine using mqtt protocol so once the design is uploaded to the server it will then be used by the machines.
Please let me know if you have any suggestions on this matter as it would be very helpful.
/r/django
https://redd.it/1hciojh
I'm building a user application which allows user to upload designs for saree's (basically the app is going to be used in textile industries in precise) here i stuck with the file uploading part like how to upload files which are around 2-30mb to the server using DRF.
for context the app is going to communicate with the machine using mqtt protocol so once the design is uploaded to the server it will then be used by the machines.
Please let me know if you have any suggestions on this matter as it would be very helpful.
/r/django
https://redd.it/1hciojh
Reddit
From the django community on Reddit
Explore this post and more from the django community