Python Learning note 24:django building a simple blog site (ii)

Source: Internet
Author: User

The previous section says how to create and run a project using Django, which says how to add a blog app.


The relationship between a project and its application


Before adding an app, let's look at what's different between the project and the app.

A project is a combination of configurations and their applications that are related to a particular Web site. A project can contain multiple apps.

An app is a WEB app that provides functionality-for example, a blogging system, a database of public records, or a simple voting system.

Applications are "pluggable": You can use one app on multiple projects, and you can distribute apps as they are not bundled into a given Django installation environment.

In this way, we can manage the module under Django, in the app unit, instead of throwing everything into a folder.


Two Add apps
Next, add an app called MyBlog on our website.
Command: python manage.py startapp myblog
After the add is complete, the directory structure is as follows:
mysite/
manage.py
mysite/
__init__.py
__init__.pyc
settings.py
Settings.pyc
urls.py
views.py
wsgi.py
myblog/
admin.py
__init__.py
models.py
tests.py
views.py



Compared to the project we created in the previous section, the Myblogmyblog directory is in the MySite directory on the previous level.
Let's go to the next section and see How to add a Web page in our app.

Python Learning note 24:django building a simple blog site (ii)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.