Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the ways to use Django

Shulou Source: shulou.com Published: 2022-06-01 00:57:53 10月01日 Update

This article mainly explains "what are the methods of using Django". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "what are the methods of using Django" together!

basis

Managing Virtual Environments with Pipenv

Using a custom user model

GCBV (Generic Class View) is preferred, and Class View is preferred over Function View.

Variables like SECRET_KET should be managed using environment variables, not written in code

Use multiple settings files, so DEBUG should not appear in production

Local use of Docker-based Postgres database (it seems that Americans prefer PostgreSQL, while domestic MySQL seems to be more)

There must be unit tests and integration tests, the more the better

security

One-step security check with Pony Checkup

Always use the latest version of Django

Deploy with SSL/HTTPS

Modify admin url instead of default/admin/

third-party packages

django-debug-toolbar Useful for debugging messages and database queries

django-extensions This repository has a collection of extension libraries, especially runserver_plus

django-allauth provides social authentication and user email confirmation

Whitenoise serves static files (you can also use S3, Amazon's object storage, and Alibaba Cloud or Qiniu in China)

Sentry logging error logs

general

There is no established directory structure for Django projects, but cookiecutter-django is the most popular.

More and more people are using the Django Rest Framework to build the Result API.

Thank you for reading, the above is the content of "What are the methods of using Django", after learning this article, I believe that everyone has a deeper understanding of what is the method of using Django, and the specific use needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Tags: Use methods environment views learning security content variables data databases files more users tests management second best warehouses functions units objects Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Redmi MySQL Microsoft Apple