as root:

  easy_install pip
  pip install virtualenv

As normal user:

$  virtualenv projectname
$  cd projectname
$  source bin/activate
(projectname):$ pip freeze
(projectname):$ pip install django==1.6.7
(projectname):$ pip install south django-registration stripe
(projectname):$ startproject djlogin

Just a bunch of code i will probably not remeber

  python startapp myapp
  python syncdb
  python runserver

First command creates app myapp, second creates tables in database according to, and the third one starts the server at port 8000.

In case you want to access the server from outside:

  python runserver

Best editor for django/python development


  • great tool for migrating & altering DB

To start using south…

Make sure your django tables match your current database tables exactly - if you planned to add or remove columns, comment those out and run:

./ schemamigration myapp --initial name_of_migration
./ migrate myapp --fake

Make changes to your django model and then run:

./ schemamigration myapp --auto
./ migrate myapp

Vim python autocomplete

Python source code encodings

If UTF-8 source file encoding is needed …

# -*- coding: UTF-8 -*-

…put this on the beginning of the source file.

Database settings

MyISAM storage:

mysql>>> ALTER TABLE search_ftext ENGINE = MyISAM;

Create fulltext index

mysql>>>  ALTER TABLE search_ftext ADD FULLTEXT (text);

if Django keeps falling after editing in admin - convert table DjangoAdminLog to the same collation as other tables:

alter table auth_user_user_permissions convert to character set utf8 collate utf8_unicode_ci;
python/django.txt · Last modified: 2015/01/28 13:12 by vondra