Django 1.7 on App Engine

Django 1.7 on App Engine

Django was actively supported at an early stage of the Python runtime in App Engine SDK through the notable django-nonrel framework, a fork of the original project that adds support for NoSql databases. But starting from the App Engine SDK 1.6.2, released more than two years ago, you can instead deploy Django’s official releases and take advantages from the whole stack of the framework.

In less than half an hour we’ll see how we can easily deploy the latest version of Django on the Google Cloud Platform, taking advantage of the tools and services provided by App Engine, Cloud SQL and Cloud Storage.

Aee59cb61d6561244163f490aec50939?s=128

Massimiliano Pippi

April 18, 2015
Tweet

Transcript

  1. Django 1.7 on App Engine It could work!

  2. Massimiliano Pippi dev.pippi.im @maxpippi

  3. None
  4. None
  5. • 2008: App Engine dev preview release • 2009: Django

    1.0 added to the Python runtime • 2011: django-nonrel • [ … ] • 2014: Cloud Sql GA release
  6. None
  7. pip install django -t /path/to/application/root # gae.pth /usr/local/google_appengine import dev_appserver;

    dev_appserver.fix_sys_path() import sys; sys.path.insert(1, ‘/path/to/application/root’) How?
  8. Why?

  9. Managed DB instances Cloud SQL • fully managed: up and

    down scaling • replication, patch management, backups • no data lock-in • MySql 5.5 and 5.6 available don’t be a jerk on MySql!
  10. Media storage Google Cloud Storage • S3 fashioned file storage

    (versioning, CDN, ACLs, …) • django media files (static files are smoothly handled by app engine by itself) • no lock-in: implemented as a django custom file storage
  11. In-memory caching Memcache • shared or dedicated instances • monitoring

    tools come for free • no lock-in: implemented as a django cache backend
  12. Asynchronous tasks Task Queue • automatic scaling • no more

    celery / python-rq • workers hit http endpoints
  13. Push notifications Google Channel API • provides js client via

    CDN • easy to use • not well suited if latency is key
  14. Authentication A non-feature of the Google Cloud Platform Getting rid

    of the Google Authentication system Use the more flexible Django contrib.auth framework instead
  15. External resources github.com/masci/django-appengine-toolkit • no need to pip install -t

    • memcache as cache backend ootb • cloud storage as storage backend ootb • database config from env vars
  16. Why not? Technology lock-in depending on the Google Cloud components

    in use Cloud SQL has no free tiers Python 2 only :(
  17. Thank you! dev.pippi.im @maxpippi