Django Build blog site (i)

Source: Internet
Author: User
Tags bootstrap website django website install django pip install django

Django Build Your own blog site (a) Introduction

This series is mainly through the use of the Django Python web framework to implement a simple personal blog site. Django has a question that can be found on the Django website.

Function
    • Background management post, modify, delete
    • Sub-label Management
Depend on

In addition to using Django, the page Layout section uses Bootstrap frames, and the story editor and parser are used separately django-pagedown markdown2 .

Install
$ pip install django$ pip install django-pagedwon$ pip install markdown2

Bootstrap can download the resource bundle on the bootstrap website and put it static under the project directory.

Start Project
$ django-admin startproject Blog

Go to the project folder to run the command:

$ python manage.py startapp post

Create a folder under the project root directory. The source of the static downloaded bootstrap is put here.

Run:

$ python manage.py runserver
Settings

In a Django project, settings.py It is the configuration file for the project.

Database

The database I am using is MySQL, and the new project defaults to using SQLite, so the settings for the database need to be changed:

# settings.py= {    ‘default‘: {        ‘ENGINE‘‘django.db.backends.mysql‘,        ‘NAME‘‘django_dev‘,        ‘USER‘:‘root‘,        ‘PASSWORD‘:‘123456‘,        ‘HOST‘:‘127.0.0.1‘,        ‘PORT‘:‘3306‘,    }}

Changes will also be made later settings.py .

Then, the project database is django_dev , the database to be created in MySQL itself, because the site is mainly used in Chinese, so the code is set to utf-8 :

create database django_dev default character set utf8;
Time

Django default time is the United States, to use the time in Beijing, you need to change the time TIME_ZONE zone in China, specifically, can refer to the official Django document introduction.

Install the Post app
= [    ‘post.apps.PostConfig‘,    ‘django.contrib.admin‘,    ‘django.contrib.auth‘,    ‘django.contrib.contenttypes‘,    ‘django.contrib.sessions‘,    ‘django.contrib.messages‘,    ‘django.contrib.staticfiles‘,]

By this point, the project is well established.

Django Build blog site (i)

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.