Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Django

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to use Django for you. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Introduction to Django:

Django, pronounced as [`d], is an open source web development framework written in Python and follows the design of MVC. Lawrence Publishing Group developed this framework to develop a news-based website, which was released under the BSD license in July 2005. The name comes from the Belgian jazz musician DjangoReinhardt, who is a gypsy who mainly plays guitar and violin. Due to the rapid development of Django in recent years, it is more and more widely used. It is selected as 2013SDTimes100 by the famous IT development magazine SDTimes, ranking sixth in the category of "API, Library and Framework", and is considered to be a leader in this field.

The main purpose of Django is to develop database-driven websites easily and quickly. It emphasizes code reuse, multiple components can easily serve the entire framework in the form of "plug-ins", Django has many powerful third-party plug-ins, and you can even easily develop your own toolkit. This makes Django very scalable. It also emphasizes the principle of rapid development.

1: what are Bhand S and Chand S:

Bounce S: broswer-server

Cpact S: client-server

Disadvantages: suitable for local area network

The requirement of the client is very high.

The iteration cost of version is high

2: what is a frame:

The framework is the interface provided to us by others.

It is similar to building the foundation and structure of the house when building and paying wages.

Then we will fill it out and transfer it.

3: why do you want to learn frameworks:

Easy to learn and use

4 Architectural layering of company projects:

Controller view dao

5: create a django project:

Download the django project:

Pip install django==1.11.11

Create a django project

Django-admin startproject name

Catalog files in 6:django:

_ _ init__.py: he is the initialization file of the project. With this file, the current folder is a package that can be referenced.

Settings.py:

All the django configuration information is in here.

Configuration of static files including the configuration of the database

There are also third-party extension packs that django depends on

Urls.py: he's the routing dispatcher I just mentioned.

Wsgi.py: it is the startup file of a server, which is needed for the launch of the later project.

Manage.py: he is the startup file for the entire Django project

7: open the django project

Enter the project level directory

Then run python manage.py runsevrer

Django came with a developer server when it was started.

So we don't need to be like other languages.

Additional configuration server information

8: create a django_app:

Python manage.py startapp name

9: run django:

Execute python manage.py runserver after entering the project directory

The running process of 10:django:

Request-urls.py-- match view-- views.py-models-Link database-return data rendering template

Configuration of the 11:settings file:

Change the language to: zh-hans

Time zone changed to: Asia/Shanghai

The templates template should also be configured: os.path.join (BASE_DIR,'template')

This is the end of the article on "how to use Django". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report