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

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.

Massimiliano Pippi

April 18, 2015
Tweet

More Decks by Massimiliano Pippi

Other Decks in Programming

Transcript

  1. • 2008: App Engine dev preview release • 2009: Django

    1.0 added to the Python runtime • 2011: django-nonrel • [ … ] • 2014: Cloud Sql GA release
  2. 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?
  3. 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!
  4. 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
  5. In-memory caching Memcache • shared or dedicated instances • monitoring

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

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

    CDN • easy to use • not well suited if latency is key
  8. 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
  9. 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
  10. Why not? Technology lock-in depending on the Google Cloud components

    in use Cloud SQL has no free tiers Python 2 only :(