Skip to main content

pytz with memcache modified to be high performance that also works on GAE ( copied from pytz-2014.4 )

Project description

latest version at https://github.com/HatsuneMiku/pytz-memcache

pytz with memcache modified to be high performance that also works on GAE

( copied from pytz-2014.4 )

Usage

  • copy zoneinfo.zip to your application directory (current directory on GAE)

  • copy pytz-2014.4-gae-py2.X.egg to your application directory

import os

if 'SERVER_SOFTWARE' in os.environ.keys(): # on GAE
  from google.appengine.api import memcache
  from google.appengine.ext import webapp
  # use zoneinfo.zip on current directory
  # pytz-2014.4-py2.5.egg does not work on GAE (pytz.common_timezones is [])
  sys.path.append('pytz-2014.4-gae-py2.5.egg')
else:
  import memcache

import pytz

class GAEHandler(webapp.RequestHandler):
  def get(self, param):
    self.response.out.write(pytz.common_timezones)

Remarks

  • ‘zoneinfo.zip’ must be in your application directory

  • memcached must be running on ‘127.0.0.1:11211’ (for local test only)

  • (memcached has been running on GAE)

  • it takes about few seconds to run at the first time, but faster next

  • (it takes very long time when memcahced is not running because worst case)

  • please delete key ‘pytz_loaded’ from cache when update pytz zoneinfo

Do It Yourself

  • unzip pytz-2014.4-py2.X.egg

  • delete *.pyc

  • zip recursive pytz/zoneinfo/ to zoneinfo.zip

  • copy zoneinfo.zip to your application directory (current directory on GAE)

  • replace init.py open_resource function (in this repository)

  • zip pytz/ to pytz-2014.4-gae-py2.X.egg (without zoneinfo.zip)

  • copy pytz-2014.4-gae-py2.X.egg to your application directory

Requirements

  • pytz (included)

  • python-memcached (for local test only)

Relations

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytz-memcache-2014.4.33.tar.gz (604.8 kB view details)

Uploaded Source

File details

Details for the file pytz-memcache-2014.4.33.tar.gz.

File metadata

File hashes

Hashes for pytz-memcache-2014.4.33.tar.gz
Algorithm Hash digest
SHA256 bd0b79ff167ff6d98baa3353dac2ad4dbbb42fc5d4a2986a41b2c8f6c9927fea
MD5 c9cc9d9d2a511fc5b5f0f0314b11630b
BLAKE2b-256 5acb01c0234b32c7e4e17afc653889f38bdfa80414c2ef4abe92d305473d3812

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page