Writing Maintenance Mode Middleware in Django (with tests)!

Поділитися
Вставка
  • Опубліковано 25 січ 2025

КОМЕНТАРІ • 31

  • @bugbytes3923
    @bugbytes3923  9 місяців тому +1

    Check this video to learn how to re-write these tests with Pytest!
    ua-cam.com/video/pdatgYDXmSE/v-deo.html

  • @iwswordpress
    @iwswordpress 9 місяців тому +2

    Tests are a great bonus!

  • @aminzahedsadeghi4995
    @aminzahedsadeghi4995 9 місяців тому +1

    Thanks a lot for this great Django course 🤩. Please make a video about async ORM and async views in Django, and how we should integrate Django ORM with our views and when we should use it. This is content that I don't see any good sources for.

    • @bugbytes3923
      @bugbytes3923  9 місяців тому

      Thanks! Great suggestion, will do so in the future.

  • @AmoahDevLabs
    @AmoahDevLabs 9 місяців тому

    This is really informative. Thanks for sharing.

    • @bugbytes3923
      @bugbytes3923  9 місяців тому

      Thanks very much, glad it was helpful!

  • @Septumsempra8818
    @Septumsempra8818 9 місяців тому

    1:31 Could we do some vids on strategies for updating data of a production site? How best do we change a large portion of our data (80%) without affecting performance?

    • @bugbytes3923
      @bugbytes3923  9 місяців тому

      I think that'd be interesting, for sure - I'll have a look into it. Thanks!

  • @kimuyu
    @kimuyu 9 місяців тому

    Excellent tute as usual. If you could look into manually rendering inlineformsets with , that would be a hit.

    • @bugbytes3923
      @bugbytes3923  9 місяців тому

      Thanks! I'll have a think about that one.

  • @hipertracker
    @hipertracker 9 місяців тому +1

    Good job. You could add also pytest example..

    • @bugbytes3923
      @bugbytes3923  9 місяців тому

      Thanks! I'll add a quick follow up video for the pytest example.

  • @francoisschoeman5350
    @francoisschoeman5350 9 місяців тому

    Great vid, thanks! I would also love a video about both using and creating webhooks... Pleeeeezzz....😁

    • @bugbytes3923
      @bugbytes3923  9 місяців тому

      Haha great suggestion. I'll have a look at webhooks in the near future.

  • @Peterstavrou
    @Peterstavrou 9 місяців тому +1

    Another amazing video!
    When checking if a variable has been set in settings, do you usually use if settings.MAINTENANCE_MODE or if hasattr(settings, 'MAINTENANCE_MODE ') and settings.MAINTENANCE_MODE is not None? Which is best practice to use?

    • @bugbytes3923
      @bugbytes3923  9 місяців тому

      Thanks Peter!
      Your example there is a better suggestion, for sure.
      Use hasattr(settings, 'MAINTENANCE_MODE') and settings.MAINTENANCE_MODE is not None - to ensure that the value is defined in the settings before accessing it.

  • @frameff9073
    @frameff9073 9 місяців тому +2

    good thank

  • @aashayamballi
    @aashayamballi 9 місяців тому

    thank you!

  • @estersone
    @estersone 9 місяців тому

    Make video about integrating django with ML

  • @serychristianrenaud
    @serychristianrenaud 9 місяців тому

    Thanks 👍

  • @TheNerdyPlayer
    @TheNerdyPlayer 9 місяців тому

    Would it be possible to do this without restarting the server? For example reading the value from cache in the middleware or at this point it's just easier to do it with nginx or something. Very cool video gave me tons of ideas to test out myself. :) much love

    • @georgejoseph2601
      @georgejoseph2601 9 місяців тому

      Just run django inside a docker container

    • @TheNerdyPlayer
      @TheNerdyPlayer 9 місяців тому

      @@georgejoseph2601 how would running a docker container prevent the need to restart the webserver? im not talking about the whole linux server my dude

    • @bugbytes3923
      @bugbytes3923  9 місяців тому

      Thanks for the comment!
      You could indeed set this value in the database or the cache, and the Middleware could read the value from that source instead of just the settings.
      The MAINTENANCE_MODE value could then be updated via the Django Admin or some other mechanism. With that setup, no need to stop/restart the server, I don't think!

    • @georgejoseph2601
      @georgejoseph2601 9 місяців тому

      @TheNerdyPlayer running Django within a slim python/alpine docker container allows changes to settings files to propagate without an explicit restart while you test things out. Just an option

  • @_russell
    @_russell 9 місяців тому

    When you doing a video on `django-components`?

    • @bugbytes3923
      @bugbytes3923  9 місяців тому +1

      Preparing it now! Just ironing out a few details but it should be out this month.