Python Daily
2.56K subscribers
1.49K photos
53 videos
2 files
39.1K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
When using Firebase Auth with Django, where do you store user settings?

If I want to host my app on AWS, but want to use Firebase Auth (since Cognito sucks).

Do I use the DB on Firebase purely for Authentication and keep it separate from Django for security purposes?

Or do I integrate it into my Django models?

And where to store all users' settings, preferences, payment data, and special permissions, on my AWS DB or Firebase Auth DB?

For example, if I need to send an email newsletter, how do I fetch the emails? I need to access firebase (if so through a Django model?)? or should I keep a separate copy of necessary user data on my main AWS DB?

/r/django
https://redd.it/zx1c9r
P We finally got Text-to-PowerPoint working!! (Generative AI for Slides )

Hey everyone!

Joe and I are students at Stanford, and we finally got a breakthrough on our side project.

We call it:

ChatBCG: Generative AI for Slides

or: Text-to-PowerPoint

(Hope it will replace consultants one day :D)

Check out our launch Tweet for more info:
https://twitter.com/SilasAlberti/status/1608037989623414791

Do you have any feedback? We would really appreciate it :)

/r/MachineLearning
https://redd.it/zxab4m
This code ran fine in Pycharm, I have tried all sorts of variations, what am I missing?

/r/JupyterNotebooks
https://redd.it/zwqg8a
Check if email exist in database without refresh page

Please i want do in my registration form check if user write user name or email it will automaticaly check if is use in db or not and let the user know if can use this email or not. Can comeon help me with that solution ? I use Flask and sql alchemy.


here is my db

class Costumer(db.Model, UserMixin):
# -------------------Uzivatel-------------------
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(50), unique=True)
email = db.Column(db.String(50), unique=True)
phone = db.Column(db.String(50), unique=True)
password = db.Column(db.String(200), unique=False)


# --------------- Fakturacni udaje ---------------------
faktura_first_name = db.Column(db.String(50), unique=False, nullable=True)
faktura_last_name = db.Column(db.String(50), unique=False, nullable=True)
faktura_city = db.Column(db.String(50), unique=False, nullable=True)
faktura_street = db.Column(db.String(50), unique=False, nullable=True)


/r/flask
https://redd.it/zwvjrr
How to ask for user input during the running?

I am trying to develop a web application by Flask that runs a function, this function does some calculations, in some point, it needs an input from the user, then this input will be taken to continue the calculations.

How can I achieve that in an efficient way in Flask?

(Note: the user input is required in different points for different purposes).

/r/flask
https://redd.it/zwo0zb
I need some feedback on the README for my Django Base Site

I have a new draft of the README for my Django Base Site, and I would love some feedback. The goal is to encourage more people to use it. I'm biased of course, but I think it would help beginners and seasoned veteran jump-start any new project.

/r/django
https://redd.it/zyak8e
mission-commander needs proper UI

Instead of rockets, it controls Transmission clients. Specifically, it adds the RSS functionality. More about it on github:

https://github.com/jure965/mission-commander

Currently it only has built-in admin pages, but has otherwise worked for me flawlessly for about two months. It is a Django project with Celery and is dockerized for easy deployment and a no mess experience.

If you are willing to learn and/or exercise Django templates, you are welcome to contribute. Project is small - under 5 models, and all work is voluntary. CSS framework(bootstrap, tailwind, ...) at your discretion, if you want to use one. I'll try to support you in any way I can, by answering questions you may have and by commenting the pull requests. In general, the following pages are in todo, but not limited to: login, feeds, torrents, transmission clients.

/r/djangolearning
https://redd.it/zy5dk6
Deploying to Railway

So, I currently have my SECRET KEY and DEBUG in an env file and I’m using Python-decouple to implement them. However, Railway is crashing and it seems the only way I get an app deployed is by exposing my SECRET KEY. Is there a better way?

/r/django
https://redd.it/zyl0c0
How to change the passwords error messages

How do you customize the password error messages? More precisely, is there an error name for "password too common" or "password too short" like "unique" is an error name? Can I do some

self.fields["password1"].error_message = {"password_too_short": "password too short"}

kind of magic?

/r/django
https://redd.it/zym5ud
How to prevent access to a route ?

How to prevent access to a route unless it has been called from another route. I have created a login page that accepts only one user ( username and password of admin) and after the user credentials is correct, it redirects to another route called /display. But this /display route can be accessed just by typing inside the search bar of the browser. I want to prevent the access, unless it is redirected from the login page. I felt using flask_admin and flask_login was too complex. If there is another method please suggest thanks.

/r/flask
https://redd.it/zyd1nl
I want to add unit tests to my Django project but don't know where do i even start



Hey everyone,

I developped an app at my workplace (i'm not a developper officially) using Django, it allows users to login, view data, make comments on data X.

Since it is a quite simple CRUD app, i managed to make it work without any unit testing. I never did any unit tests in my small developper life (5 years).

Now they're asking me to add the option to send out emails containing data X.

I thought this feature would be a good use case for learning unit tests.

Where do i even start? Probably would have to start by something very simple to first get the hang of what unit testing is. Any roadmap to suggest?

I'm quite good at coding and getting stuff done using google (or OpenAI now...), but would like to become more of a real software developper and i know it starts with writing testable code.

Thanks guys.

/r/djangolearning
https://redd.it/zynykr
How to save a list inside my a SQL Database model ?

How can I save a list inside a database model ?

testlist = ["name1". "name2", "name3"]

class Listing(models.Model):
listing
price = models.CharField(maxlength=100)
listing
type = models.CharField(maxlength=100)
listing
list = models.?????

/r/djangolearning
https://redd.it/zyio95
Where am i going wrong

So im following [https://www.youtube.com/watch?v=sm1mokevMWk](https://www.youtube.com/watch?v=sm1mokevMWk) this tutorial and at 49:20 he heads towards the admin dashboard.

When i try the same thing i get a

main.models.ToDoList.DoesNotExist: ToDoList matching query does not exist.

On my cmd

Just to clarify this is my code in [views.py](https://views.py)

from django.shortcuts import render
from django.http import HttpResponse
from .models import ToDoList,Items
def index(response,id):
ls=ToDoList.objects.get(id=id)
item=ls.item_set.get(id=1)
return HttpResponse("<h1>%s</h1><br></br><p>%s</p>"%(ls.name,str(item.text)))

&#x200B;

/r/djangolearning
https://redd.it/zy0x35
OpenAI just rick rolled me...

https://imgur.com/a/cDLSnHw

Was tinkering around with how to write a python file to download a youtube video and was very interested to see what video it had suggested as a placeholder...

/r/Python
https://redd.it/zyyv9z
Handling relations using Django REST Framework ModelSerializer

Hi there, I have been working with DRF for a few years. I currently work as a lead developer at a small Canadian company with a very complex piece of Django stack that is responsible for a relatively large cashflow (we were recently acquire by a very large company). I often see developers jumping into Python/Django world and get very confused about how to use DRF ModelSerializer, and sometimes devs get scared away by the amount of unknown abstraction behind ModelSerializer, they choose to use Serializer instead and implement a lot of the functionality that is already provided by ModelSerializer. So I finally sat down over Christmas break here and wrote this tutorial over the last couple of days, I hope that it helps to explain how to use ModelSerializer to handle model relationships:

https://github.com/oscarychen/deep-dive-drf-model-serializer-relations

It is kind of a difficult read as it touches a lot of nitty gritty implementation details, any suggestion is welcome.

/r/django
https://redd.it/zyuskh