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
-
rbenv -
gem (command) -
bundler -
rake / rails -
active admin -
api mode -
devise -
byebug -
pry -
rspec -
factory bot -
rubocop
DJANGO
-
pyenv -
pip -
pipenv -
manage.py -
built into django -
django rest framework -
built into django -
ipdb -
ipython -
built into django -
factory boy -
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
- 240