Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Free Django!

Free Django!

Avatar for Eugene Oskin

Eugene Oskin

January 20, 2018
Tweet

More Decks by Eugene Oskin

Other Decks in Programming

Transcript

  1. Diving inside Backend In software engineering, front end (frontend) and

    back end (backend) distinguish between the separation of concerns between the presentation layer (the front end) – which is the interface between the user – and the data access layer (the back end).
  2. • LAMP ◦ Linux – OS ◦ Apache – web

    (also nginx) ◦ MySQL – database (also postgres) ◦ PHP – frontend + backend (also Django, Ruby on Rails) Basic Architecture
  3. Basic Architecture • LAMP • MEAN ◦ MongoDB – database

    ◦ Express.js – web ◦ Angular.js – frontend ◦ Node.js – backend
  4. Why Django? • Fast development • Strong community • Secure

    • Featured • Like Ruby on Rails, but Django
  5. Structure • project/ ◦ manage.py # entrypoint ◦ mysite/ #

    dir with site staff ▪ __init__.py ▪ settings.py # site settings ▪ urls.py # URL declarations ▪ wsgi.py # entry-point for WSGI-compatible
  6. Structure • project/pet/ ▪ __init__.py ▪ migrations/ • __init__.py ▪

    models.py ▪ tests.py ▪ views.py # Contollers ▪ urls.py # app URL declarations
  7. Django REST Framework • Features ◦ Great architecture ◦ Easy

    to add to an existed project ◦ Plenty of existed apps
  8. Django REST Framework • Features • Usage ◦ Install ◦

    Add Router ◦ Add ViewSet ◦ Add Serializers ◦ Add Tests
  9. Simple Django app • How to start (Do it!): ◦

    Install python and pip ◦ https://docs.djangoproject.com/en/2.0/intro/install/
  10. Simple Django app • How to start (Do it!): ◦

    Install python and pip ◦ https://docs.djangoproject.com/en/2.0/intro/install/ ◦ https://docs.djangoproject.com/en/2.0/intro/tutorial01/
  11. Simple Django app • How to start (Do it!): ◦

    Install python and pip ◦ https://docs.djangoproject.com/en/2.0/intro/install/ ◦ https://docs.djangoproject.com/en/2.0/intro/tutorial01/ ◦ Run localserver
  12. Simple Django app • How to start (Do it!) •

    My sample • https://github.com/EvgeneOskin/animals-drf
  13. References • http://bit.ly/lamp-wiki • https://www.djangoproject.com/ • https://docs.djangoproject.com/en/2.0/intro/install/ • https://docs.djangoproject.com/en/2.0/intro/tutorial01/ •

    http://django-rest-framework.org/ • http://djangopackages.com/ • https://github.com/EvgeneOskin/animals-drf • http://www.intenct.nl/projects/django-allauth/
  14. Advices • Do not use aggregations in admin page! •

    Add a crash reporter (eg. Sentry) and track your app version! • Have a strong deployment process! • Do not run datamigrations in service start!