From ArchWiki
Revision as of 05:50, 7 September 2011 by Emiralle (talk | contribs) (put quote in quotations, add link to Python wiki page)
Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

"Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design."


Django can be installed through pacman by installing the 'django' package.

# pacman -S django

There is also an svn PKGBUILD available in the AUR, 'django-svn'. Using yaourt it can be installed as follows.

# yaourt -S django-svn

Of course, you can always download it directly from The Official Website


Django is not used like other python libraries for the most part, but it can. After installation, you should be able to simply import django in any python script.

>>> import django

In order to start a project, use

$ startproject myproject

This will create the directory myproject under the current directory. It will also create the script, which has more useful functions for managing and testing your project. For instance, django has a small test server built into

$ python2 runserver
Validating models...
0 errors found

Django version 1.1, using settings 'modsite.settings'
Development server is running at
Quit the server with CONTROL-C.

It can be changed to run at, say, port 8080 like so.

$ python2 runserver 8080
Validating models...
0 errors found

Django version 1.1, using settings 'modsite.settings'
Development server is running at
Quit the server with CONTROL-C.

For more help, please see the Django Book or Official Django Documentation

eric4-IDE Tips & Tricks

Eric4 is a good IDE for Django. It has Highlighting, Autocompletion, CVS & Subversion, Debugger, and Breakpoints.

First install eric4 and eric-plugins

pacman -S eric eric-plugins

To start a new Django Project.

First click on the "Project/new." Then under "Project Type" select Django. After your new django project has been created, Right-click on the "Project Viewer", to the Left, and select "Configure", and in the configuration window set "Project type" to Django.

After that, in eric4's "Settings/Preferences" select Django, from the left, and add this change to the "Console Command."


konsole --workdir `pwd` -e
konsole --workdir `pwd` --noclose -e

This will solve the problem...

/usr/bin/python2: can't open file '': [Errno 2] No such file or directory

Note the "Django" menu next to "Project" and "Extras". There you will find Django tools to runserver and sync database.

Now, just play around with it a little. All your Python code will be Added to the first tab of the "Project-Viewer" and your html templates will be opened in the second tab.