Home > Backend Development > Python Tutorial > How to configure URL when a Django project contains multiple applications

How to configure URL when a Django project contains multiple applications

不言
Release: 2018-06-01 14:37:59
Original
2434 people have browsed it

This article mainly introduces the configuration method of URL when the Django project contains multiple applications. It has a certain reference value. Now I share it with you. Friends in need can refer to it

A Django In most cases, there will be multiple applications in the project. How to configure the URLs of multiple applications?

There are two options:

1. Configure different url paths for each application in the urls.py of the Django project

2. Introduce the url configuration file of each application and different urls into the urls.py of the overall project. The paths are configured separately in their respective configuration files

We recommend the second url preparation method:

In the urls.py file of the Django project, introduce the url configuration file of the 'blog' application

In the blog's own urls.py, introduce the views

After that, open the command window in the project path, enter pytyon manage.py runserver to start the Django service,

enter the address localhost:8000/blog, if the following information is displayed, it means the url configuration is successful.

Related recommendations:

Method to directly return the request from Django’s middleware

The above is the detailed content of How to configure URL when a Django project contains multiple applications. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template