Preface:

Recently, I was in charge of the background upgrade of the official website in my company. Before, the website was a simple static page, and the content of each page could be replaced in the background during the upgrade. Therefore, I looked for a lot of CMS tools about Django, such as FeinCMS, Mezzanine and Django-cms. I found django-CMS was a better fit for my needs. First, it integrates placeholder perfectly to meet the requirements of Page content replacement (WYSIWYG), as well as functions such as Page management, extensible menu system, plugin-based extension mechanism, etc. Second, it has high user usage and detailed documentation. Interface aesthetics, significantly improved Django backend interface aesthetics. However, Django-CMS is not an out-of-the-box product. There are no templates or themes to be found online. The official documentation is written in English, which makes it difficult for beginners to get started quickly.

Install django CMS

We’ll start by installing the virtual environment

Version for

Django CMS requires django 1.8, 1.9, 1.10 and Python 2.7, 3.3, or 3.4

Create and activate the virtual environment

We assume that you have virtualEnv installed and that you understand the basics of using it.

virtualenv env
source env/bin/activate
Copy the code

If you use Windows, you need to activate the environment in this way

env\Scripts\activate
Copy the code

Update the PIP

PIP is a Python installer that ensures you have the latest installation.

pip install --upgrade pip
Copy the code

Use the Django CMS installer

Installation:

pip install djangocms-installer
Copy the code

It provides a new command, djangocms

Create a new working directory and go to it

mkdir tutorial-project
cd tutorial-project
Copy the code

Create a Django project and name it mysite

djangocms -f -p . mysite
Copy the code

The above command means:

  • Run the Django CMS installer
  • -fInstall Django FilerThis tutorial requires
  • -pUse the current directory as the parent directory of the new project directory
  • mysiteName of the new project

Note: If the current directory is not empty, you need to add -s, but existing files may be overwritten

Setting. Py will set some default parameters after installation. You are advised to change the parameters according to actual conditions.

By default, the installer creates an admin account with the username admin and password admin

Start the development server

python manage.py runserver
Copy the code

Open http://localhost:8000/ in your browser and youll see the Django CMS login page