Django for Rails Developers

kalil@rootstrap.com

github.com/kaozdl

THE PYTHON DEVELOPMENT ENVIRONMENT

  • pyenv - Tracks and selects python versions, similar to rbenv

  • virtualenv - isolates dependencies inside a folder (similar to node_modules)

  • pip - Installs packages inside current virtualenv

  • pipenv - Tracks dependencies (Like Gemfile/Gemfile.lock)

MVC vs MVT

Just a name change?

Development philosopies

"Convention over Configuration"

Rails

"Explicit is better than implicit"

Django

Let's Start From Scratch!

COMMANDS WORTH REMEMBERING

  • django admin startproject - Creates a project

  • python manage.py startapp - Creates an app

  • python manage.py createsuperuser - Creates an admin user

  • python manage.py RUNSERVER - STARTS THE SERVER

For APP CREATION

COMMANDS WORTH REMEMBERING

  • Python manage.py makemigrations - Detects changes in models and GENERATES migrations

  • python manage.py MIGRATE - APPLIES UNAPPLIED MIGRATIONS

  • python manage.py SHOWMIGRATIONS - SHOWS THE ALL THE MIGRATIONS AND THEIR STATE

  • python manage.py SHELL - STARTS AN INTERACTIVE SHELL

For APP MAINTAINANCE

RAILS

 - rails new


 - rails g migration


 - rails db:migrate


 - rails console

DJANGO

- django-admin startproject

- python manage.py makemigrations

- python manage.py migrate

- python manage.py shell

ECOSYSTEM COMPARISON

RAILS

  1. rbenv
  2. gem (command)
  3. bundler
  4. rake / rails
  5. active admin
  6. api mode
  7. devise
  8. byebug
  9. pry
  10. rspec
  11. factory bot 
  12. rubocop

DJANGO

  1. pyenv
  2. pip
  3. pipenv
  4. manage.py
  5. built into django
  6. django rest framework
  7. built into django
  8. ipdb
  9. ipython
  10. built into django
  11. factory boy
  12. flake8

Questions?

Thanks for listening!

All the code can be found in:
https://github.com/kaozdl/django_for_rails_developers

Django for Rails Developers

By Kalil De Lima

Django for Rails Developers

  • 239