We're thinking of rewriting our go / java API in python, what do we need to think about?
Background:
We have a horrible hodgepodge of APIs in front of our data platform, java that mostly calls underlying functions in the go (with slightly more user friendly calls). The go API often calls bash scripts to do the actual work. Most of the stuff the API does is building a call for an external service like doing spark submit on the file the user has provided or creating a table in hive with details the user has provided. The java API has swagger and is mostly what all users call.
One option we have is to rewrite it all in go getting rid of java and bash, write swagger into the go and all the things the java does.
But we're predominantly a python shop, which means whenever something needs to be done with the APIs only a few people are prepared to go near it and it's recieved very little change over the years where the rest of the platform is moving on rapidly.
So a few of us are in favour for rewiteing it all in something like fastAPI, (or maybe black sheep?)
From what I understand this would basically give us swagger for free and mean there
/r/Python
https://redd.it/1gdavp9
Background:
We have a horrible hodgepodge of APIs in front of our data platform, java that mostly calls underlying functions in the go (with slightly more user friendly calls). The go API often calls bash scripts to do the actual work. Most of the stuff the API does is building a call for an external service like doing spark submit on the file the user has provided or creating a table in hive with details the user has provided. The java API has swagger and is mostly what all users call.
One option we have is to rewrite it all in go getting rid of java and bash, write swagger into the go and all the things the java does.
But we're predominantly a python shop, which means whenever something needs to be done with the APIs only a few people are prepared to go near it and it's recieved very little change over the years where the rest of the platform is moving on rapidly.
So a few of us are in favour for rewiteing it all in something like fastAPI, (or maybe black sheep?)
From what I understand this would basically give us swagger for free and mean there
/r/Python
https://redd.it/1gdavp9
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
profile pic not showing
models.py:
class Profile(models.Model):
user = models.OneToOneField(User,ondelete=models.CASCADE)
userimage = models.ImageField(uploadto="userpic/")
def str(self):
return self.user.username
urls.py:
from django.conf import settings
from django.conf.urls.static import static
urlpatterns += +static(settings.MEDIAURL, documentroot=settings.MEDIAROOT)
html template:
<img src="{{ user.profile.userimage.url }}" alt="img">
error showing in terminal:
Not Found: /picture/userpic/10987982.jpg
GET /picture/userpic/10987982.jpg HTTP/1.1" 404 2270
the image stored in picture/user_pic/ but not rendered on html template but user name and first name is render in html template
/r/django
https://redd.it/1gdbbd8
models.py:
class Profile(models.Model):
user = models.OneToOneField(User,ondelete=models.CASCADE)
userimage = models.ImageField(uploadto="userpic/")
def str(self):
return self.user.username
urls.py:
from django.conf import settings
from django.conf.urls.static import static
urlpatterns += +static(settings.MEDIAURL, documentroot=settings.MEDIAROOT)
html template:
<img src="{{ user.profile.userimage.url }}" alt="img">
error showing in terminal:
Not Found: /picture/userpic/10987982.jpg
GET /picture/userpic/10987982.jpg HTTP/1.1" 404 2270
the image stored in picture/user_pic/ but not rendered on html template but user name and first name is render in html template
/r/django
https://redd.it/1gdbbd8
Reddit
From the django community on Reddit
Explore this post and more from the django community
How can I incorporate data science in Django project?
Hello, I’m working on a data science project for academic research. I need to do some data analysis (I mean, data acquisition, pre-processing and data processing), specifically, it is about natural language processing so I also need to train a machine learning model I can get an output I can put in a map (a Google map).
I’ve selected Django as the back-end framework I will use together with Flutter to develop my user interface for a mobile app in which I can deploy my map.
So, my question is how can I handle my data analysis code into the Django project so I am able to map the output of my analysis into my geographic map, that is to say: where do I have to put my data analysis logic in the Django project considering I am planning to save the data I retrieve externally into a database based on my models? and, consequently how can I store the analysis into the database?
Somebody told me about using microservices but, is that really necessary? In which cases are they used? And, can I manage this locally or what approach should I use to manage this data processing? at what point would I
/r/django
https://redd.it/1gd0wms
Hello, I’m working on a data science project for academic research. I need to do some data analysis (I mean, data acquisition, pre-processing and data processing), specifically, it is about natural language processing so I also need to train a machine learning model I can get an output I can put in a map (a Google map).
I’ve selected Django as the back-end framework I will use together with Flutter to develop my user interface for a mobile app in which I can deploy my map.
So, my question is how can I handle my data analysis code into the Django project so I am able to map the output of my analysis into my geographic map, that is to say: where do I have to put my data analysis logic in the Django project considering I am planning to save the data I retrieve externally into a database based on my models? and, consequently how can I store the analysis into the database?
Somebody told me about using microservices but, is that really necessary? In which cases are they used? And, can I manage this locally or what approach should I use to manage this data processing? at what point would I
/r/django
https://redd.it/1gd0wms
Reddit
From the django community on Reddit
Explore this post and more from the django community
Discord recommendations for Flask Devs?
What are the best Discords for Flask developers? Some general python discords are welcomed as well.
/r/flask
https://redd.it/1gdg84b
What are the best Discords for Flask developers? Some general python discords are welcomed as well.
/r/flask
https://redd.it/1gdg84b
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Can I use both CPU and GPU cores simultaeneously?
I am currently working on an economic model using anaconda and Im kinda new to this.
The simulation is kinda slower than macbook m1 chips where it would take thrice the amount of time to complete the simulation
I am wondering if I can use both gpu (rx6600) and cpu (r7 5700x) to have as much cores for computing power.
/r/Python
https://redd.it/1gddbc6
I am currently working on an economic model using anaconda and Im kinda new to this.
The simulation is kinda slower than macbook m1 chips where it would take thrice the amount of time to complete the simulation
I am wondering if I can use both gpu (rx6600) and cpu (r7 5700x) to have as much cores for computing power.
/r/Python
https://redd.it/1gddbc6
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Tailwind styles aren’t working with forms
Trying to get my tailwind styles to work with my login form.
I am using django-tailwind. But some reason styles aren’t taking. I’ve restarted with tailwind server and Django server no change.
```
from django.contrib.auth.models import User # Ensure you import the correct User model
from django import forms
class LoginForm(forms.ModelForm):
class Meta:
model = User
fields = ['username', 'password']
username = forms.CharField(
label='Username',
widget=forms.TextInput(attrs={
'class': 'bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 '
'focus:border-primary-600 block p-2.5 dark:bg-gray-700 dark:border-gray-600 '
'dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500',
'placeholder': 'Username'
}),
required=True
)
/r/djangolearning
https://redd.it/1gdnfko
Trying to get my tailwind styles to work with my login form.
I am using django-tailwind. But some reason styles aren’t taking. I’ve restarted with tailwind server and Django server no change.
```
from django.contrib.auth.models import User # Ensure you import the correct User model
from django import forms
class LoginForm(forms.ModelForm):
class Meta:
model = User
fields = ['username', 'password']
username = forms.CharField(
label='Username',
widget=forms.TextInput(attrs={
'class': 'bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 '
'focus:border-primary-600 block p-2.5 dark:bg-gray-700 dark:border-gray-600 '
'dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500',
'placeholder': 'Username'
}),
required=True
)
/r/djangolearning
https://redd.it/1gdnfko
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Monday Daily Thread: Project ideas!
# Weekly Thread: Project Ideas 💡
Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.
## How it Works:
1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.
## Guidelines:
* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.
# Example Submissions:
## Project Idea: Chatbot
**Difficulty**: Intermediate
**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar
**Description**: Create a chatbot that can answer FAQs for a website.
**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)
# Project Idea: Weather Dashboard
**Difficulty**: Beginner
**Tech Stack**: HTML, CSS, JavaScript, API
**Description**: Build a dashboard that displays real-time weather information using a weather API.
**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)
## Project Idea: File Organizer
**Difficulty**: Beginner
**Tech Stack**: Python, File I/O
**Description**: Create a script that organizes files in a directory into sub-folders based on file type.
**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)
Let's help each other grow. Happy
/r/Python
https://redd.it/1gdoyr5
# Weekly Thread: Project Ideas 💡
Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.
## How it Works:
1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.
## Guidelines:
* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.
# Example Submissions:
## Project Idea: Chatbot
**Difficulty**: Intermediate
**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar
**Description**: Create a chatbot that can answer FAQs for a website.
**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)
# Project Idea: Weather Dashboard
**Difficulty**: Beginner
**Tech Stack**: HTML, CSS, JavaScript, API
**Description**: Build a dashboard that displays real-time weather information using a weather API.
**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)
## Project Idea: File Organizer
**Difficulty**: Beginner
**Tech Stack**: Python, File I/O
**Description**: Create a script that organizes files in a directory into sub-folders based on file type.
**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)
Let's help each other grow. Happy
/r/Python
https://redd.it/1gdoyr5
YouTube
Build & Integrate your own custom chatbot to a website (Python & JavaScript)
In this fun project you learn how to build a custom chatbot in Python and then integrate this to a website using Flask and JavaScript.
Starter Files: https://github.com/patrickloeber/chatbot-deployment
Get my Free NumPy Handbook: https://www.python-engi…
Starter Files: https://github.com/patrickloeber/chatbot-deployment
Get my Free NumPy Handbook: https://www.python-engi…
SmartProfiler: The All-in-One Solution for Python Performance Insights
# What My Project Does
SmartProfiler is a lightweight Python library that simplifies profiling your code by providing insights into execution time, memory usage, CPU time, and function call counts. Whether you’re optimizing performance, debugging, or monitoring function calls in multithreaded applications, SmartProfiler has you covered with minimal setup and overhead.
# Target Audience
SmartProfiler is perfect for:
Data Scientists who need to optimize data processing tasks.
Developers looking to enhance the performance of their applications.
Researchers who require detailed profiling for simulations or computations.
Anyone working with Python who wants to gain insights into their code's performance.
# Comparison
While many profiling tools focus on specific metrics, such as memory or execution time, SmartProfiler uniquely combines:
Unified Profiling: All-in-one solution for profiling time, memory, CPU, and function calls.
Thread-Safe: Specifically designed for multithreaded environments, avoiding race conditions.
Minimal Overhead: Provides accurate profiling with little impact on application performance.
# Key Features
Function-Level Profiling: Easily profile functions with decorators.
Code Block and Line Profiling: Profile specific blocks or lines using context managers.
Multithreaded Profiling: Supports profiling in concurrent applications.
Flexible Logging: Integrates with Python's logging framework for detailed insights.
Function Call Tracking: Count function calls efficiently in a thread-safe manner.
# Example Usage
# Time Profiling for Functions
/r/Python
https://redd.it/1gdjz16
# What My Project Does
SmartProfiler is a lightweight Python library that simplifies profiling your code by providing insights into execution time, memory usage, CPU time, and function call counts. Whether you’re optimizing performance, debugging, or monitoring function calls in multithreaded applications, SmartProfiler has you covered with minimal setup and overhead.
# Target Audience
SmartProfiler is perfect for:
Data Scientists who need to optimize data processing tasks.
Developers looking to enhance the performance of their applications.
Researchers who require detailed profiling for simulations or computations.
Anyone working with Python who wants to gain insights into their code's performance.
# Comparison
While many profiling tools focus on specific metrics, such as memory or execution time, SmartProfiler uniquely combines:
Unified Profiling: All-in-one solution for profiling time, memory, CPU, and function calls.
Thread-Safe: Specifically designed for multithreaded environments, avoiding race conditions.
Minimal Overhead: Provides accurate profiling with little impact on application performance.
# Key Features
Function-Level Profiling: Easily profile functions with decorators.
Code Block and Line Profiling: Profile specific blocks or lines using context managers.
Multithreaded Profiling: Supports profiling in concurrent applications.
Flexible Logging: Integrates with Python's logging framework for detailed insights.
Function Call Tracking: Count function calls efficiently in a thread-safe manner.
# Example Usage
# Time Profiling for Functions
/r/Python
https://redd.it/1gdjz16
Reddit
From the Python community on Reddit: SmartProfiler: The All-in-One Solution for Python Performance Insights
Explore this post and more from the Python community
5 months ago i asked which course to start django with ,now what's my next step ?
Greetings,
Five months ago, I created a post asking about how to start with Django. Months later, I completed a few courses, including a four-month ALX backend Django-focused course, and I made few basic API projects and few simple CRUD functionality projects using function-based views (FBV) and class-based views (CBV). Here’s one of my projects: https://github.com/Gamaljim/Fitness\_dj\_api (excuse the lack of a README or .gitignore file; I'm still learning how to properly set up a repo).
I'm 30 years old, stuck in a dead-end job in a country I don't want to be in, and I'm doing my best to study after work to shift my career and get back home as soon as possible. After finishing the course, I asked my instructor for feedback, and he said there’s still a lot to learn and that I’m not ready to apply for jobs yet. I understand this, but it did bring me down, and while I wouldn't say I'm depressed, I definitely feel low.
Now, to get to my question: What should I learn next? I've heard about CI/CD, Docker, Redis, and Celery, but these are foreign terms to me, and I don't know where and what to start with.
I hope you understand
/r/django
https://redd.it/1gdr3co
Greetings,
Five months ago, I created a post asking about how to start with Django. Months later, I completed a few courses, including a four-month ALX backend Django-focused course, and I made few basic API projects and few simple CRUD functionality projects using function-based views (FBV) and class-based views (CBV). Here’s one of my projects: https://github.com/Gamaljim/Fitness\_dj\_api (excuse the lack of a README or .gitignore file; I'm still learning how to properly set up a repo).
I'm 30 years old, stuck in a dead-end job in a country I don't want to be in, and I'm doing my best to study after work to shift my career and get back home as soon as possible. After finishing the course, I asked my instructor for feedback, and he said there’s still a lot to learn and that I’m not ready to apply for jobs yet. I understand this, but it did bring me down, and while I wouldn't say I'm depressed, I definitely feel low.
Now, to get to my question: What should I learn next? I've heard about CI/CD, Docker, Redis, and Celery, but these are foreign terms to me, and I don't know where and what to start with.
I hope you understand
/r/django
https://redd.it/1gdr3co
GitHub
GitHub - Gamaljim/Fitness_dj_api
Contribute to Gamaljim/Fitness_dj_api development by creating an account on GitHub.
Developing a Python-based Graphics Engine: Nirvana-3D
Hello community members,
[Crossposted from: https://www.reddit.com/r/gamedev/comments/1gdbazh/developing\_a\_pythonbased\_graphics\_engine\_nirvana3d/ \]
I'm currently working in GameDev and am currently reading and working on a 3D Graphics/Game Engine called: Nirvana 3D, a game engine totally written from top to bottom on Python that relies on
Nirvana is currently at a very nascent and experimental stage that supports importing
While it has some basic support handling different 3D stuff, the Python code has started showing its limitations regarding speed - the rendering of a single frame takes up to 1-2 minutes on the CPU. While Python is a very basic, simple language, I wonder I'd have to port a large part of my code to GPUs or some Graphics Hardware languages like GLES/OpenCL/OpenGL/Vulcan or something.
I've planned the support for PBR shaders (Cook-Torrance Equation, with GGX approximations of Distribution and Geometry Functions) in solid mode as well as PBR shaders with HDRi lighting for texture-based image rendering and getting a
/r/Python
https://redd.it/1gdbl5l
Hello community members,
[Crossposted from: https://www.reddit.com/r/gamedev/comments/1gdbazh/developing\_a\_pythonbased\_graphics\_engine\_nirvana3d/ \]
I'm currently working in GameDev and am currently reading and working on a 3D Graphics/Game Engine called: Nirvana 3D, a game engine totally written from top to bottom on Python that relies on
NumPy Library for matrices and Matplotlib for rendering 3D scenes and imageio library for opening image files in the (R, G, B) format of matrices.Nirvana is currently at a very nascent and experimental stage that supports importing
*.obj files, basic lighting via sunlights, calculation of normals to the surface, z-buffer, and rendering 3D scenes. It additionally supports basic 3D transformations - such as rotation, scaling, translations, etc, with the support of multiple cameras and scenes in either of these three modes - wireframes, solid (lambert), lambertian shaders, etc.While it has some basic support handling different 3D stuff, the Python code has started showing its limitations regarding speed - the rendering of a single frame takes up to 1-2 minutes on the CPU. While Python is a very basic, simple language, I wonder I'd have to port a large part of my code to GPUs or some Graphics Hardware languages like GLES/OpenCL/OpenGL/Vulcan or something.
I've planned the support for PBR shaders (Cook-Torrance Equation, with GGX approximations of Distribution and Geometry Functions) in solid mode as well as PBR shaders with HDRi lighting for texture-based image rendering and getting a
/r/Python
https://redd.it/1gdbl5l
Reddit
From the gamedev community on Reddit: Developing a Python-based Graphics Engine: Nirvana-3D
Explore this post and more from the gamedev community
Django REST framework project for managing product of e-commerce application
I created this Django project for an e-commerce project's product management a few months ago with the Django REST framework.
If anyone wants to use it here is the link.
https://github.com/abdulawalarif/ecommerce\_backend\_DRF
/r/django
https://redd.it/1gdtv66
I created this Django project for an e-commerce project's product management a few months ago with the Django REST framework.
If anyone wants to use it here is the link.
https://github.com/abdulawalarif/ecommerce\_backend\_DRF
/r/django
https://redd.it/1gdtv66
GitHub
GitHub - abdulawalarif/ecommerce_backend_DRF: E-commerce Product API app using Django REST framework
E-commerce Product API app using Django REST framework - abdulawalarif/ecommerce_backend_DRF
🔮Blackjack Strategy Simulator: The Most Comprehensive Open-Source Tool for Blackjack Analysis! 🔮
The **Blackjack Strategy Simulator** is a powerful tool for simulating every possible blackjack scenario to help users find the best move in any situation.
## What My Project Does
It allows you to:
* **Generate custom basic strategy tables** for various rule sets, including card splits and surrender options.
* **Simulate and analyze expected value (EV)** to understand the profitability of different strategies.
* **Calculate the best possible action** for any hand, considering complex rules and deck compositions.
* **Create advanced strategies** that adapt based on card counting or pre-set strategies.
## Comparison to Existing Alternatives
The **Blackjack Strategy Simulator** stands out in a few key areas:
* **Customization:** Unlike many online blackjack calculators, this simulator allows users to configure various game rules, including the number of decks, dealer behavior on soft 17, and advanced options like card counting deviations.
* **Detailed Analysis:** The tool provides a more thorough analysis than most basic calculators, considering complex scenarios such as multiple splits and custom deck compositions.
* **Open-Source Flexibility:** As an open-source project, it is highly customizable, with support for additional strategies and rule sets. Existing alternatives often lack this level of flexibility and transparency.
This tool offers a detailed approach to blackjack analysis by simulating millions of hands with high accuracy and
/r/Python
https://redd.it/1gdg3e9
The **Blackjack Strategy Simulator** is a powerful tool for simulating every possible blackjack scenario to help users find the best move in any situation.
## What My Project Does
It allows you to:
* **Generate custom basic strategy tables** for various rule sets, including card splits and surrender options.
* **Simulate and analyze expected value (EV)** to understand the profitability of different strategies.
* **Calculate the best possible action** for any hand, considering complex rules and deck compositions.
* **Create advanced strategies** that adapt based on card counting or pre-set strategies.
## Comparison to Existing Alternatives
The **Blackjack Strategy Simulator** stands out in a few key areas:
* **Customization:** Unlike many online blackjack calculators, this simulator allows users to configure various game rules, including the number of decks, dealer behavior on soft 17, and advanced options like card counting deviations.
* **Detailed Analysis:** The tool provides a more thorough analysis than most basic calculators, considering complex scenarios such as multiple splits and custom deck compositions.
* **Open-Source Flexibility:** As an open-source project, it is highly customizable, with support for additional strategies and rule sets. Existing alternatives often lack this level of flexibility and transparency.
This tool offers a detailed approach to blackjack analysis by simulating millions of hands with high accuracy and
/r/Python
https://redd.it/1gdg3e9
Reddit
From the Python community on Reddit: 🔮Blackjack Strategy Simulator: The Most Comprehensive Open-Source Tool for Blackjack Analysis!…
Explore this post and more from the Python community
I made a guide on how to debug python using ipdb
I tried to make it as straight to the point as possible. Let me know what you think and if there’s another useful python package you’d like me to check out.
https://youtu.be/EnC9ciDkXqA?si=T-Gm3KfFr-OIgCLN
/r/Python
https://redd.it/1gdwo2h
I tried to make it as straight to the point as possible. Let me know what you think and if there’s another useful python package you’d like me to check out.
https://youtu.be/EnC9ciDkXqA?si=T-Gm3KfFr-OIgCLN
/r/Python
https://redd.it/1gdwo2h
YouTube
How to use ipdb the interactive python debugger
Let's talk about how to debug python without a load of pesky print statements and instead use ipdb - the interactive python debugger.
#programming #python #ipdb #debugger #debugging #coding
Check out the ipdb github here: https://github.com/gotcha/ipdb…
#programming #python #ipdb #debugger #debugging #coding
Check out the ipdb github here: https://github.com/gotcha/ipdb…
MFA for Django rest framework
Hi folks
I created TOTP to our dashboard so users can add MFA i have searched a lot for a package to do it but found nothing
So i have created this package from my code that works very well on production i found other packages but for Django not for rest framework this package is very simple and easy to use
It's my first time to release a Diango package so i wish it can help you and if you found it helpful please give it a star
https://github.com/mohamed-alired/drf-totp
/r/djangolearning
https://redd.it/1gcpbei
Hi folks
I created TOTP to our dashboard so users can add MFA i have searched a lot for a package to do it but found nothing
So i have created this package from my code that works very well on production i found other packages but for Django not for rest framework this package is very simple and easy to use
It's my first time to release a Diango package so i wish it can help you and if you found it helpful please give it a star
https://github.com/mohamed-alired/drf-totp
/r/djangolearning
https://redd.it/1gcpbei
GitHub
GitHub - mohamed-alired/drf-totp: TOTP (Time-based One-Time Password) authentication for Django REST Framework.
TOTP (Time-based One-Time Password) authentication for Django REST Framework. - mohamed-alired/drf-totp