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)