5 step django CMS tutorial for new developers
The django CMS is an easy to use, open-source content management build using Django/Python. It is a great option for new developers who wish to create a site that tailors to their needs. The user-friendly interface is aimed at developers and content editors. There are plenty of addons in the Django marketplace created by a live active community of developers.The setup is incredibly simple, and in this django CMS tutorial, we’ll take you through the first five steps to help get you started.
What you need to get started
First of all, you don’t need to be a senior developer or have prior experience as a developer with Django or Python to create your first django CMS demo website. The added benefit of django CMS, is it’s free.
Before we begin the django CMS tutorial, you will need to know that there are three ways to install django CMS for free.
You can either set up a project on Divio Cloud, which is fast and useful for people without a technical background and a good starting point to experience the CMS User Interface.
As another option, you can set up the project using the djangocms-installer. It is a good way for a developer locally without an external vendor and we use this option in this django CMS demo.
The last option is to install django CMS manually by using virtualenv. This option is a good way for developers that want to install everything by hand to understand better and have full control.
For the installation, you need a plain-text code editor to work on the code, configuration, and a virtual environment. django CMS requires Django 1.11 or newer and Python 2.7 or 3.3 or newer.
Step 1: Create a virtual environment
Before you start installing the django CMS demo, you need to create and activate your virtual environment. By using the Virtualenv you are using the third method described in this tutorial, but there are other ways of creating a virtual environment. For example, in Python 3 there is a built-in venv module:
python -m venv env
First, you need to create an empty virtualenv:
And activate the virtual environment:
To verify that the source is activated and that you are now using the correct python and pip you can check by running the following commands and checking that the paths are correct and using your new virtual environment
`which python` `which pip`
Step 2: Update pip
Pip is the Python installer we use in this django CMS tutorial. Make sure your pip is up to date, since earlier versions can be unreliable.
pip install --upgrade pip
Step 3: Use the django CMS installer
Using the django CMS tutorial, you can create a complete and fully featured django CMS project saved locally.
After downloading the django cms demo from the django cms website, you can start installing the djangocms-installer.
pip install djangocms-installer
Alternatively, you can also install it with Nephila’s django CMS installer:
In the next step, you create a new project directory and add cd into it
mkdir tutorial-project cd tutorial-project
Run the django CMS installer to create a new django project called mysite:
djangocms -f -p . mysite
- Additionally, you can install the django Filer (-f) as well
- Use the current directory as the parent of the new project directory (-p)
About django Filer:
Django Filer is a useful application for managing files and processing images. It is not required for the django CMS demo, but recommended, since many django CMS addons use the Filer, and nearly all django CMS projects have it installed.
Start the development server
$ python manage.py runserver
Open your browser and insert http://localhost:8000/; there you should be invited to login and continue with Step 4: create your first page.
Step 4: Create your first page
- Once you login you can press Create on the top right.
- Then you will see a pop-up window where the “New page” is marked blue.
- Press New Page and select Next.
After selecting Next, you will add in your title and some basic text content for the new page, click Create.
Here is your newly created page.
Step 5: Publish your page
The page we just created is just a draft and needs to be published once you finish. As an editor, only you can see and edit your drafts, other visitors to your site will only see your published pages.
Press "Publish page now."
To edit the page, you can switch back into editing mode using the "Edit" button, and return to the published version of the page using the "view published" button.
In the editing mode, you can double-click on the paragraph of the text to change it, add formatting, and save it again. Any changes that are made after publishing are saved to a draft and will not be visible until you re-publish.
Your next steps: Join the django CMS Association and help shaping the future of django CMS
As an open-source project django CMS is depending on the contribution of the community. If you have stake in django CMS and love django CMS as much as we do, you should consider joining the project and contribute to django CMS. Join the django CMS Association and meet many like-minded people and deepen your knowledge. Together we can bring this project to the next level!
Are you interested in learning more from django CMS tutorials? Then have a look at the django vs laravel blog post from what.digital where you can read an in-depth comparison on which web framework to choose.blog comments powered by Disqus