Sourav Basu

@souravbasu17

General Talks: DRY your Django APIs

Submitted Aug 25, 2017

Your Django APIs start small and grow into a mess unless checked in time. This talk is how we can keep those APIs clean and small even with huge number of methods and classes using some sort of architecture. This is aimed at both the beginner and intermediate level of Django developers.

Outline

I will be covering both REST Framework Views and basic Django Views using templates.

  1. Request Validations
    We keep having existential checks for every API that requires some data. Also sometimes we have to check for data type. We can cut down on these lines of code.

  2. Error Messaging
    This is about giving proper error messaging. Its more than having a strings file where we pass the same string. How about having to write the exception handling only once and forget about it.

  3. Code Structuring
    This is more of a personal experience of structuring that helped me. This is not necesarrily the only way.

  4. Cleaner DB operations
    Db APIs should raise Errors and they should be handled in a clean way so as to maintain uniformity across APIs.

Requirements

N/A

Speaker bio

I work for an organization called Credy where we have implemented the things mentioned in this talk and I am part of a team that implemented this and part of the whole idea of implementation as well. I have been working professionally on Django/Python since 2015 and I am aware of some of the problems that this talk solves.

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

Submit Proposals for PyConf Hyderabad more