Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Currex - Pythonic currency calculator with exchange rates

Repo: [https://github.com/stared/currex](https://github.com/stared/currex)
Demo: [try in Google Colab without installing anything](https://colab.research.google.com/github/stared/currex/blob/main/currex.ipynb)

I often use Python as a command-line calculator. However, I frequently found myself going back to Google Search to convert between currencies. So, I created this library to make adding, multiplying, and converting between currencies easy. One of its core features is autocasting - when working with multiple currencies, it automatically converts them to match the first currency used.

# What My Project Does

Currex is a Pythonic currency calculator that makes working with currencies and exchange rates simple and smooth. It allows you to:

- Add, subtract, multiply, and divide currencies as if they were numbers
- Easily convert between currencies (e.g., USD to EUR)
- Autocast when mixing multiple currencies (they automatically convert to the first currency referenced)
- Fetch exchange rates from [HexaRate](https://hexarate.paikama.co/) in real-time

Here's a simple example:

```python
from currex import *

# use currencies as if they were numbers
100 * USD # USD(100.00)
12 * USD(100) # USD(1200.00)

# convert currencies to other currencies
USD(100).to(EUR) # EUR(85.30)
USD(100).to(PLN) # PLN(430.50)

# this syntax is also supported
PLN(EUR(12)) # PLN(51.33)


/r/Python
https://redd.it/1i9sn69
Best AI for python programming?

I've been using Chatgpt, but it isn't up to the mark. Like it can code but when I prompt it to code without this module/function, it fails most of the time. Would love to get to know which AI does the best.



/r/Python
https://redd.it/1iabwj1
D Simple Questions Thread

Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

Thanks to everyone for answering questions in the previous thread!

/r/MachineLearning
https://redd.it/1iai5g6
Deploying Django and Wagtail on Cloud Servers: A Step-by-Step Guide

🚀 Are you struggling to deploy your Django or Wagtail projects on cloud servers like AWS, DigitalOcean, or Hetzner? I’ve been there too, which is why I’ve documented the entire process to help others simplify their deployment journey!

I’m excited to share two repositories that provide comprehensive deployment guides:

1️⃣ Django Deployment on Hetzner (and similar cloud servers):
🔗 GitHub: Django Hetzner Deployment

2️⃣ Wagtail Deployment on Hetzner (and similar cloud servers):
🔗 GitHub: Wagtail Hetzner Deployment

These repositories include:
Setting up your server environment
Installing necessary dependencies (e.g., Docker, PostgreSQL)
Configuring Nginx and Gunicorn for production
Tips for handling static and media files
Streamlined deployment steps

Whether you’re hosting on AWS, DigitalOcean, Hetzner, or another provider, the principles outlined here can be easily adapted to fit your setup.

💡 Why I created this:
I wanted to make it easier for developers to deploy their projects without running into unnecessary roadblocks. If you’re new to cloud hosting or looking for a practical guide, this documentation might be just what you need.

I’d love to hear your feedback or suggestions for improvement. Let me know if these guides help you, or feel free to contribute

/r/django
https://redd.it/1iaa8om
Django e-commerce

In the past couple of months, i have been updating my Django e-commerce project and would love to share.

It mainly involves utilizing Django template, DigitalOcean, Whitenoise for static files, and Azure for PostgreSQL, and Azure Blob Storage for handling media only

https://voxmart.co.tz/


/r/django
https://redd.it/1ia59ga
I have been enjoying django these months

I researched the suitable stack to use before working on the product idea in mind, some folks crucified Django while others praised it. But learning to know of some major tech coys using Django is some relief.

We built a mentee meet mentor app for data & AI folks purely on Django at the backend and it has been fun. Though I want to improve API response time in deployment, I'm good outside that. https://semis.reispartechnologies.com/. Mentors can host group sessions and share their profiles for folks to connect with them.

Django at the backend is great, our app has evolved and will still do. Currently, we vet mentors before accepting. We are not there yet obviously, it's a learning experience for me. . Thank you Python & Django :)

/r/django
https://redd.it/1iaon81
How do I host flask web application on ubuntu VPS? (hostinger)?

recently i purchased a vps from hostinger but unfortunately there's no support for python flask but it allows various apps, panels, and plain OS as well. but i genuinely don't know what I'm doing. and I do want to connect a custom domain as well.

/r/flask
https://redd.it/1iao8zo
Django, Postgres, and Pytest

Apologies for the rather basic question, but I'm developing an app locally and have just switched from sqlite to postgres. The database for the app is working fine, but not so the temporary database that Pytest (or unittest) sets up. I keep getting errors like this: 'django.db.utils.ProgrammingError: relation "users_customuser" does not exist', which suggests that the tables in the test DB are not being created correctly. I've tried mucking around with migrations, and the USER permissions for the test DB appear appropriate (though by no means do I have a lot of expertise with postgres). I'm wondering if anyone knows the answer to this, or is aware of some kind of resource or tutorial out there that focuses on the intersection of Django, postgres, and testing?



/r/django
https://redd.it/1iatk98
Flask-alchemy create Models

Hey Guys and Girls,

I´m wondering about a lot over Tutorials. I´m workin on my first little Flask Web App. I´m a student for Media Tech with intermediate or better good understanding whatsoever.

In many Tutorials this "Mapped" SQLALchemy 2.0 style just does not exist. Why is that? Is there any big difference?

The SQL ALchemy Tutorial tells me to use that style over the old style... I dont get it.

Or it is like Flask-alchemy is using the old style?

# SQL ALCHEMY 2.0 STYLE

class Base(DeclarativeBase):
    pass

db = SQLAlchemy(modelclass=Base)

class Sailor(Base):
    tablename = 'sailor'
    id: Mapped[int] = mapped
column(primarykey=True)
    username: Mapped[str] = mapped
column(String(50), nullable=False)
    password: Mappedstr = mappedcolumn(String(50), nullable=False)

#S SQL ALCHEMY OLD STYLE

class Sailor(db.base):
tablename = 'sailor'
id = db.Column(db.Integer, primary
key =

/r/flask
https://redd.it/1iac4im
Question about an unexpected error

I'm creating a flask app following the flask-mega-tutorial of Miguel. I'm at the seven chapter (but i skipped the six one because i thught that was useless for my purpose). I tried to run the app but i receive this error:
ImportError: cannot import name 'errors' from partially initialized module 'app' (most likely due to a circular import) (C:\\Users\\myuser\\OneDrive\\Desktop\\microblog\\app\\__init__.py)

This is the line code that receives the error: from app import routes, models, errors

Why doesn't it work in my program but in the tutorial it does?

/r/flask
https://redd.it/1iai0oh
Need Design Suggestions for My Django App Dashboards

Hi guys,

I have a simple setup with a regular user and superuser dashboard:

If you log in with regular user credentials, you’re taken to the regular user dashboard, where you can view the "mailing list" from a PostgreSQL database.
If you log in as a superuser, you’ll be taken to the Super User Dashboard, where you can CRUD the mailing list from the same PostgreSQL database.

The problem now is the design of the dashboards, login, and signup pages. I’ve mostly used a template from Bootstrap (CSS and JavaScript), Google Fonts, static CSS, and style.css.

My boss wants the web app to have a "professional" or "client-ready" look.

Can you suggest any designs or templates I can easily integrate into my web application?

Thanks in advance!

Here is the sample interface:

Login Screen

Sign-Up Screen

Super User Dashboard

User Management \(Where the super users can see all the users and can edit\/delete users and also their recent action logs are shown

Regular User Dashboard \(where the regular users can see the mailing list and generate report via \(CSV\/PDF file\)



/r/django
https://redd.it/1iayme6
Looking for some advice!

Finished a python tech degree with TeamTreehouse and then went on to do a course from Dennis Ivy on the django framework... Since then have built my own little project and launced it on heroku. Previous to this I was doing a FEWD course but decided that it wasn't really my forte.. I mean it would be alright to have to do a bit of it here and there if I was working on a team and noticed something wasn't jiving but ALL day long I would prefer not to be doing design.. My question is this.. I know we have all had imposture syndrome at some point.. I have been doing this off and on now learning for lets say a year and I am wondering where does one even look for a django job! Or how would you reccomend to start? Really and truly at this point I would love to do an internship and be a part of a team or work on a project with a community but every time I go looking for jobs or internships it seems not many people specify django in their posting... Should I be branching off and learning something else?

/r/django
https://redd.it/1iar3rh
what happened to 'djang road' the youtuber???

do you guys know about the youtuber name django road? all of sudden, she disappeared.. her channel is gone.. what happen??

/r/django
https://redd.it/1ib53ov
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/1iaug3w
Multicharting + Live Streaming Tool for IBKR

# What My Project Does

It's finally here! I set out on my journey on Python 4 years to one day create my own trading/charting tool. Now, I am sharing this dashboard that has been an on-off project along this journey. It comes together with the following features:

* Live data, together with candlestick charting thats updated on intervals.
* Multi-charting functionalities, up to 6 charts per screen (you can open multiple tabs).
* In the home page, a built in Bloomberg news stream.
* Ticker search functionalities on IBKR offerings.
* Indicators in Typescript, and can be added on to in the code.

For now, the project data streams only caters to IBKR, which is what I am using primarily. Hopefully through this post, I can find contributors much more talented than me (which I am sure most of you are) to work together and continue making improvements this project. The main goal to continue to work towards making a non-paywalled, high-quality analytics completely open source.

Thank you for taking the time to read this, and you can check out the project here: [https://github.com/lvxhnat/ibkr-charts](https://github.com/lvxhnat/ibkr-charts) :)

# Target Audience

Engineers / developers with IBKR accounts interested in trading/investments.

# Comparison

I am not aware of any other open source tools that connects to

/r/Python
https://redd.it/1ibbbib
How to build AI Agents with Django

I have written an article on how to build AI Agents with Django using Celery and redis as a broker. I explain how to communicate with a frontend server in real time with channels (websockets)

https://medium.com/@cubode/how-to-build-ai-agents-with-django-5abf1b228e00

Hope you enjoy it :) Ask me if you would like something more detailed

/r/django
https://redd.it/1ib7xht
Question about implementation of sending emails

I'm creating a web application following Miguel's mega-tutorial.
I'm on lesson 7 and I've encountered a problem: for some reason, despite having intentionally caused an error in my site, no message appears in the second terminal where aiosmtpd is running.
I don't understand why nothing appears. These are my bits of code that I used to try to make this stuff work:

in config file:

import os

basedir = os.path.abspath(os.path.dirname(__file__))  # Questa variabile immagazzina il percorso della directory principale sottoforma di stringa

class Config:
    SECRET_KEY = os.environ.get('SECRET_KEY') or b'mykey'
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
        'sqlite:///' + os.path.join(basedir, 'app.db')
   
    MAIL_SERVER = os.environ.get('MAIL_SERVER')
    MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
    MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
    MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
    MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
    ADMINS = ['mymail@example.com']


in init file:



/r/flask
https://redd.it/1ibjlyy
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1ibo7qe