11. Flow

With practice you will gradually memorize and automate many of the mechanisms or tests that you should always perform. Nevertheless, to smooth out the difficulty curve and help you speed up the process, I offer you a good workflow when facing the declaration of a new Endpoint. A guideline that nobody taught me at the time and that I would have been extremely grateful for.

  1. Document the Endpoints.
  2. Create test (It will fail)
  3. Define model.
  4. Define the view.
  5. Define Serializer.
  6. Register routes.
  7. Run test (It will pass successfully).
  8. Configure Admin.

If you work in a team, everything changes (just a little bit). You must incorporate Git and continuous integration, creating a solid and productive flow to kill bugs before they are born.

  1. You create a branch from develop with the name of the task.
  2. Document the Endpoints. We like Notion.
  3. Create test (It will fail). We work with Pytest.
  4. Define model.
  5. Configure the view.
  6. Define the Serializer.
  7. Register routes.
  8. Run a linter. We love Black.
  9. Run test (It will pass successfully).
  10. Configure Admin.
  11. Merge Request: Push the changes to the repository, creating a Merge Request and assigning a random teammate to review it.
  12. CI/CD: Automatically, CI/CD will check for conflicts, run the linter and tests again. If everything is fine, the changes will be deployed to the Staging (beta) server. Otherwise, the code is reviewed to see what failed. Gitlab is a blessing for this stage. The author of the Merge Request will automatically be notified by chat that their change has been integrated. Like many, we rely on Slack.

I hope you find it useful.

Building SPAs with Django and HTML Over the Wire: Learn to build real-time single page applications with Python

Building SPAs with Django and HTML Over the Wire: Learn to build real-time single page applications with Python

The HTML over WebSockets approach simplifies single-page application (SPA) development and lets you bypass learning a JavaScript rendering framework such as React, Vue, or Angular, moving the logic to Python. This web application development book provides you with all the Django tools you need to simplify your developments with real-time results.

Buy the book

Help me keep writing

Every coffee gives me a push toward the next article.

Comments

There are no comments yet.