Django or Flask: How Do I Choose Which To Use?
As a Python developer, I love both Flask and Django. But how do I choose which one to use? Over the years I've developed a very simple test that helps me decide if I'm going to use Flask or Django for my projects.
Using Signals to Clean Up My Mess in Django
While trying to cascade deletes of Droplets when I delete the parent Class they
would have been associated with in DigitalOcean Classroom, I attempted to
delete method. This only works part of the time, so I instead
turned to signals, specifically the
post_delete signal. Now no matter what
triggers the delete on the Class, my Droplets are cleaned up and deleted from
my account. I plan to use signals more for the creation process as well.
@receiver(post_delete, sender=Droplet) def droplet_delete(sender, instance, using, **kwargs): droplet = digitalocean.Droplet(token=settings.DO_TOKEN, id=instance.droplet_id) try: droplet.destroy() except NotFoundError: pass
On my business card, I am a Developer Advocate. In my mind, I am an engineer. But in my heart, I am a teacher