[Python] Django builds a simple record of a personal blog system

Hits: 0

In fact, this is a demo I made after I studied python in my junior year. It was recorded at that time. When I look at it now, I think about moving it to my blog, just as a record. The things in the computer are always It may be lost one day.


[Django] is an open source web application framework written in Python.
Using Django, Python programmers can easily complete most of the content required for a formal website with very little code, and further develop full-featured Web services. Now use python+Django to build a simple personal blog system:

The entire project implementation process:

build environment

Setting up the development environment: Install django
• Win 10 (64-bit)
• Python 3.6.6
• Django 3.1.4

Create project:

By the way, you need to enter the env environment to
run whether the build is successful:

Create and configure app features

Configure in urls.py:
re-configure in setting.py:
create a new one under your own blog project urls.py, configure url:
data migration after modification: python.py makemigrations,python manager.py migrate

Model model

View view

With the views view function, you also need to configure URLconfs to associate the URL links requested by the user. Then urls.py:

Create an administrator account (Superuser)

The administrator account (Superuser) is an account that can enter the background of the website and maintain data, and has high authority. Here we need to create an administrator account in order to add subsequent test data, use the command to create:

python manage.py createsuperuser

After the operation is successful, you will be asked to enter the user name and password, email, etc., and finally submit the data table registration to the background:
run the terminal python manage.py runserver, then enter the browser:
you can see the background login interface:
after logging in, you can operate through the interface:


Templates are all htmlfiles, only part of them.

Run the project:

python manager.py runserver

After successful compilation, you can access it through the browser: the effect

The effect of the whole project is as follows:

Click on the local server address:

Log in:

Post blog:

Implement message:

There are only so many functions. I used to follow others to do it, but now I have forgotten it. There are still a small part of the functions that have not been completed…
There will be time to improve it later~~

You may also like...

Leave a Reply

Your email address will not be published.