DEV Community

Ayin Kim
Ayin Kim

Posted on • Edited on

Personal guideline - docker & django

Abstract.
This post will be updated whenever I have an update regarding the contents here. The post is written by junior level developer. So please, read at your own risk :)

[First guide found]
Dockerizing a python Django Web Application
https://semaphoreci.com/community/tutorials/dockerizing-a-python-django-web-application

And here is template like.
https://github.com/agusmakmun/django-markdown-editor

  1. What Docker is
  2. prerequisite to use the template above (forking)
  3. Create a Python virtual environment
  4. Gunicorn(HTTP server) and Martor (markdown plugin)
  5. Then, makemigrations, migrate etc.
  6. Testing code (TDD)
  7. Static vs Dynamic Files
  8. About nature of Django explanation. Know the difference.
  9. Style Checker (Flake8)
  10. Additional integration, github Note: you may manually setup this part from docker hub and github (settings, Secrets, Actions Secrets -> Repo secrets). This part is one of important setup with docker.
  11. Now Docker. Writing the Dockerfile
  12. Building and running the container.
  13. CI/CD (achieve this with github actions as well)
  14. About dockerizing pipeline

Comment:
Some part offers advanced platform service to use. This guide does not have an example of setting up github actions.

[Second guide found] - docker & github actions
https://stackoverflow.com/questions/57549439/how-do-i-use-docker-with-github-actions

To setup Github Actions in your project:

  1. Set up checks.yml The contents of code in this file will be shown in Github Actions once it is pushed in git via your VSCode.

Django - Official Documentation

  1. https://docs.djangoproject.com/en/4.2/topics/testing/overview/ TDD guideline. How to use django.test and TestCase in a nutshell.

1.04
https://docs.djangoproject.com/en/4.2/ref/models/querysets/

1.05
https://docs.djangoproject.com/en/4.2/topics/testing/tools/#django.test.Client.post
Testing tools. Recommended for any django user if you need:
(1) simulate GET and POST requests on a URL and observer response
(2) check the URL and all chain of redirects occur
(3) Test that a given request is rendered by django template (with context), which contains certain value.
There is API that only has access to the HTTP methods (e.g. RequestFactory)

1.1 https://docs.djangoproject.com/en/4.2/topics/testing/advanced/#testing-reusable-applications
Unlike the description in url, this is must-read if you plan to test out each feature you were going to build.

  1. https://docs.djangoproject.com/en/4.2/intro/overview/
    Recommended for initial setup.

  2. https://docs.djangoproject.com/en/4.2/topics/auth/
    Authentication. (users, permissions, group, config password in hash, forms and view for logging in or blocking content.) Literally all about user account feature. Try navigating other links on this page - those will guide you how to achieve your plan.

3.1 https://docs.djangoproject.com/en/4.2/topics/auth/default/#user-objects
A related link from authentication : username, password, email, first_name, last_name. And you know what these are.

3.2
https://docs.djangoproject.com/en/4.2/ref/contrib/auth/#django.contrib.auth.models.User
An API reference, for authentication part.

Top comments (0)