Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
python:django [2014/12/10 11:46]
vondra [Installation]
python:django [2015/01/28 13:12] (current)
vondra [Database settings]
Line 24: Line 24:
   python manage.py runserver   python manage.py runserver
 </​code>​ </​code>​
-First command creates app users, second creates tables in database according to models.py, and the third one starts the server at port 8000+First command creates app myapp, second creates tables in database according to models.py, and the third one starts the server at port 8000
 In case you want to access the server from outside: In case you want to access the server from outside:
 <​code>​ <​code>​
-  python manage.py runserver+  python manage.py runserver ​0.0.0.0:​8000
 </​code>​ </​code>​
  
Line 38: Line 39:
 To start using south... 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. +Make sure your django tables match your current database tables exactly - if you planned to add or remove columns, comment those out and run: 
-      - Run python ​manage.py schemamigration myapp --initial name_of_migration +<​code>​ 
-      - Run python ​manage.py migrate myapp --fake +./manage.py schemamigration myapp --initial name_of_migration 
-      ​- ​Make changes to your django model +./manage.py migrate myapp --fake 
-      - Run python ​manage.py schemamigration myapp --auto +</​code>​ 
-      - Run python ​manage.py migrate myapp+Make changes to your django model and then run: 
 +<​code>​ 
 +./manage.py schemamigration myapp --auto 
 +./manage.py migrate myapp 
 +</​code>​
  
 ====Vim python autocomplete==== ====Vim python autocomplete====
Line 56: Line 61:
 </​code>​ </​code>​
 ...put this on the beginning of the source file. ...put this on the beginning of the source file.
 +
 +
 +====Database settings====
 +MyISAM storage:
 +<​code>​
 +mysql>>>​ ALTER TABLE search_ftext ENGINE = MyISAM;
 +</​code>​
 +
 +Create fulltext index
 +
 +<​code>​
 +mysql>>> ​ ALTER TABLE search_ftext ADD FULLTEXT (text);
 +</​code>​
 +
 +if Django keeps falling after editing in admin - convert table DjangoAdminLog to the same collation as other tables:
 +<​code>​
 +alter table auth_user_user_permissions convert to character set utf8 collate utf8_unicode_ci;​
 +</​code>​
 
python/django.1418208384.txt.gz · Last modified: 2014/12/10 11:46 by vondra