DEV Community

Cover image for 9 Django Concepts - Part 3
Max Ong Zong Bao
Max Ong Zong Bao

Posted on • Originally published at maxongzb.com

9 Django Concepts - Part 3

Introduction

Welcome to the final part of the 9 Django Concepts for aspiring Django developers.

For this, I will be covering parts like deployment, testing and supporting front-end framework.

Which is a project that any Django developer who is building it for a Javascript based front-end framework.

If you had miss part 1 or part 2, I would suggest you go to those before reading this part 3 to not miss out on it.

Testing

By default, Django comes with its own testing module based upon Python's default testing library.

Which is called unittest.

Personally, I would prefer the use of Pytest.

Due to it is simple to write test cases without much boilerplate and it's Fixtures to mock data to run your test cases repeatedly.

For a tutorial on how to use Django's testing framework, I would suggest you head to Harry Perceval's free online ebook called Test Driven Development with Python or his PyCon workshop - Django TDD .

Supporting Front-end framework

Due to the popularity of Javascript front-end framework like Vue, React and Angular.

Django is being increasingly used as a backend system to provide support for front-end.

Therefore you need to use new tools or services to provide your best support of front-end.

The first library will definitely be Django REST Framework.

Which will be your bread & butter skill to be used for building REST APIs.

API Development Resources

If you are heading towards API development route for Django.

Focus on adopting tools like Postman or Swagger Editor that is based upon OpenAPI v3.

Which is an industry API design specification to speed up your API development process.

API evangelist provides tons of resources for API ecosystem.

Unless your organisation or company's front-end developer bugs you to use GraphQL, just build REST endpoints due to its maturity & eco-system on it.

For building GraphQL, there is a project called Graphene which extends your Django to provide GraphQL endpoints.

Deployment

Here I will list down both simple & complex deployment.

If you really want to learn more about deploying Django.

Just head over to get your copy of the book called High-Performance Django or the Django's Documentation on Deployment to understand Django deployment and scaling it.

Simple

My suggestion is to use a cloud hosting provider service like Linode or Heroku or DigitalOcean.

If it is just a personal website or service with a small number of users, go for these cloud hosting service providers.

Complex

Due to the complexity of the various technologies used for deploying Django.

If you are just starting out use either mod_wsgi module for apache web server or using Gunicorn or Uwsgi that is served on Nginx.

The use of Zappa is a great choice.

If you are using AWS to scale Django.

Conclusion

These are the concepts that I had encountered along the way to become a better Django developer.

Do let me know in the comments section if you had any doubts on Django concepts or the article.

Lastly, to end off this article, PyCon SG has invited the creator of Zappa Rich Jones as a keynote speaker.

If you are interested in learning about Zappa by Rich Jones, you can head on down to get your tickets for PyCon SG 2019

If you like my article, please sign up for Max Adventurer's Newsletter for awesome content I stumble across weekly in Python, Startup and Web Development.

You can also follow me to get the latest update of my article on Dev

This post was originally posted on Max's blog at Top 9 Django Concepts - Part 3: 3 Mins and Photo by Jaredd Craig on Unsplash

References

Top comments (0)