官术网_书友最值得收藏!

Python Zen and Django's design philosophy

Generally, the Python community uses the term Pythonic to describe a piece of idiomatic code. It typically refers to the principles laid out in The Zen of Python. Written like a poem, it is extremely useful to describe such a vague concept.

Try entering import this in a Python prompt to view The Zen of Python.

Furthermore, Django developers have crisply documented their design philosophies while designing the framework at https://docs.djangoproject.com/en/dev/misc/design-philosophies/.

While the document describes the thought process behind how Django was designed, it is also useful for developers using Django to build applications. Certain principles such as Don't Repeat Yourself (DRY), loose coupling, and tight cohesion can help you write more maintainable and idiomatic Django applications.

Django or Python best practices suggested by this book would be formatted in the following manner:

Use BASE_DIR in settings.py and avoid hardcoding directory names.

主站蜘蛛池模板: 夏河县| 庆云县| 石棉县| 惠州市| 平泉县| 安化县| 二连浩特市| 瑞丽市| 永和县| 内丘县| 肥城市| 习水县| 宜兰县| 长岭县| 连云港市| 金华市| 海盐县| 光山县| 龙游县| 祁连县| 永新县| 灵寿县| 永寿县| 和平县| 海晏县| 南京市| 教育| 六盘水市| 宣武区| 稻城县| 浦东新区| 兴仁县| 渭南市| 柳林县| 万载县| 南华县| 句容市| 韶山市| 甘德县| 金平| 霞浦县|