$30 off During Our Annual Pro Sale. View Details »

MIgrating from Django 1.6 to Django 1.8

somghosh
September 28, 2015

MIgrating from Django 1.6 to Django 1.8

somghosh

September 28, 2015
Tweet

Other Decks in Technology

Transcript

  1. Migrating from Django
    1.6 to 1.8
    Earthmiles

    View Slide

  2. Why Django 1.8 over 1.6?
    • Prefetch object for advanced control on
    prefetch_related [earlier it had to be only .all()]
    • Conditional Expressions - Case() and When()

    View Slide

  3. Django 1.8 - First Steps
    • Have good tests, with good coverage
    • $ pip install -U Django

    View Slide

  4. Run tests and upgrade
    packages
    django-filter==0.11.0
    python-social-auth==0.2.12
    requests==2.7.0
    requests-oauthlib==0.5.0
    six==1.9.0
    psycopg2==2.6.1
    django-debug-toolbar==1.3.2
    django-categories==1.3b8
    nose==1.3.7
    django-nose==1.4.1
    factory-boy==2.5.2
    django-taggit==0.17.0

    View Slide

  5. New admin has quirks (for
    good)
    class TrackedActivityForm(forms.ModelForm):
    class Meta:
    model = TrackedActivity
    + fields = “__all__” #now required for all fields case

    View Slide

  6. Schemamigrations from 1.6
    (with South) to 1.8
    • Perhaps a better way of achieving this is to migrate
    to 1.7 first and then to 1.8
    • At Earthmiles, we migrated directly to 1.8

    View Slide

  7. Schemamigration Steps
    • All steps up to this point
    • Remove 'south' from INSTALLED_APPS.
    • Remove South from requirements.txt
    • Delete all your (numbered) migration files, but not
    the directory or __init__.py - make sure you remove
    the .pyc files too.
    • find . -name '*.pyc' -print -exec rm -rf {} \;
    • find . -name '00*.py' -print -exec rm -rf {} \;

    View Slide

  8. Schemamigration Steps
    • All steps up to this point
    • Remove 'south' from INSTALLED_APPS.
    • Remove South from requirements.txt
    • Delete all your (numbered) migration files, but not
    the directory or __init__.py - make sure you remove
    the .pyc files too.
    • find . -name '*.pyc' -print -exec rm -rf {} \;
    • find . -name '00*.py' -print -exec rm -rf {} \;

    View Slide

  9. View Slide