Setup environment to work with Django CMS on OSX

Getting the whole python / environment / Django / server running is not that easy when you’re not familiar with it, especially if you’re used to use Apache/MySQL combo. I wrote that guide as a reminder, but I’m sure it can help you setup a Django CMS site pretty easily.

Get Python installed

Python is installed with OSX. However, you will need some development libraries that are included with XCode. So download and install XCode. Be sure to install the ‘Command Line Tools’ as well (launch XCode, go to Preferences -> downloads, and install CLT).

Install Pip

Official documentation

Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default [1], so you may have pip already.

The easiest way to install pip on your current python version is to open a terminal and type

 Install VirtualEnv

One simple command line :

 Install / Setup Django CMS

From that point, I’m following Django CMS documentation. Create a folder somewhere, navigate to it using your command line.

Create Environment

We’ll create a virtual environment for our Django CMS. Type :

That way, all our dependicies and whatnot are installed in that particular environment. Then we’ll activate it in order to use it.

Note the (django_cms) that indicates that we are currently inside the environment. Note for later : to shut it down, type “deactivate”.

Install djangocms command

Create a folder to receive our Django CMS test website

 Create the Django CMS website

You’ll have to answer several questions. The documentation recommends to use those :

  • Database configuration (in URL format): sqlite://localhost/project.db
  • django CMS version: stable
  • Django version: stable
  • Activate Django I18N / L10N setting: yes
  • Install and configure reversion support: yes
  • Languages to enable. Option can be provided multiple times, or as a comma separated list: en, fr
  • Optional default time zone: America/Vancouver:
  • Activate Django timezone support: yes
  • Activate CMS permission management: yes
  • Use Twitter Bootstrap Theme: yes
  • Use custom template set: no
  • Load a starting page with examples after installation: yes

But do not hesitate to change them.

After that, you’ll be asked to create an admin user giving a username, an email address and a password.

Run it !

One command :

Access your brand new website : http://localhost:8000/

You can access the control panel using http://localhost:8000/en/admin/

Quit the server with CONTROL-C.

Other useful info from the doc :

To log in, append ?edit to the URL and hit enter. This will enable the toolbar, from where you can log in and manage your website. Switch to Draft mode to add and edit content.

Try to switch between Live and Draft view, between Structure and Content mode, add plugins, move them around and delete them again.

To add a Text or or other plugin elements to a placeholder:

  1. switch to Structure mode
  2. select the menu icon on the placeholder’s title bar
  3. select a plugin type to add

 

Test and have fun

Well, when you come from very user friendly CMS, you can be disappointed. You should take a look at free plugins available for the CMS : Django CMS Add-ons

I can recommend the News Blog plugin. That’s a good start.

EDIT: that has changed since I wrote this. The UI is pretty cool now. It’s disorienting when you are not used to that type of CMS. But still, I like it !

 

Sources :

Install pip (official doc)

Install virtualenv (official doc)

The perfect setup for python – Django OSX

How to Set Up and Install Django CMS on a Debian 7 or Ubuntu 13

Install Django CMS (official doc)

 

Published by

Louwii

Web developer, geek, car enthusiast, photographer, DIYer, video gamer... I like many things, maybe too many?

Leave a Reply

Your email address will not be published. Required fields are marked *