Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install django-codemirror2

How to install django-codemirror2

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install django-codemirror2
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.0.4 Available View build log
Windows (64-bit)
0.0.4 Available View build log
Mac OS X (10.5+)
0.0.4 Available View build log
Linux (32-bit)
0.0.4 Available View build log
Linux (64-bit)
0.0.4 Available View build log
Lastest release
version 0.0.4 on Jul 9th, 2011

Django widgets for replacing textareas with CodeMirror2, an in-browser code editor.


  1. pip install django-codemirror2
  2. Add codemirror2 to INSTALLED_APPS
  3. Collect static files: python manage.py collectstatic

If you just want to see it in action, see the almost-ready-to-run project in examples.


from django import forms
from codemirror2.widgets import CodeMirrorEditor

class TestForm(forms.Form):
    css = forms.Charfield(widget=CodeMirrorEditor(options={'mode': 'css'}))

The options argument will be passed as JSON to CodeMirror.fromTextArea, see http://codemirror.net/manual.html#config for possible values. If you want to use a mode that depends on other modes, for example htmlmixed, you need to load the dependencies, too, by passing the modes parameter:

html = forms.Charfield(widget=CodeMirrorEditor(modes=['css', 'xml', 'javascript', 'htmlmixed'],
            options={'mode': 'htmlmixed'}))

If you want to customize the Javascript used to initialize the CodeMirror editor, use script_template:

foo = forms.Charfield(widget=CodeMirrorEditor(options={'mode': 'xml'},

Subscribe to package updates

Last updated Jul 9th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.