How to use fastly - 10 common examples

To help you get started, we’ve selected a few fastly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python / pythondotorg / downloads / models.py View on Github external
"""
    # Don't purge on fixture loads
    if kwargs.get('raw', False):
        return

    # Only purge on published instances
    if instance.is_published:
        # Purge our common pages
        purge_url('/downloads/')
        purge_url('/downloads/latest/python2/')
        purge_url('/downloads/latest/python3/')
        purge_url('/downloads/mac-osx/')
        purge_url('/downloads/source/')
        purge_url('/downloads/windows/')
        if instance.get_version() is not None:
            purge_url('/ftp/python/{}/'.format(instance.get_version()))
        # See issue #584 for details
        purge_url('/box/supernav-python-downloads/')
        purge_url('/box/homepage-downloads/')
        purge_url('/box/download-sources/')
        # Purge the release page itself
        purge_url(instance.get_absolute_url())
github python / pythondotorg / successstories / models.py View on Github external
if instance.is_published and instance.featured:
        content = render_to_string('successstories/supernav.html', {
            'story': instance,
        })

        box, _ = Box.objects.update_or_create(
            label='supernav-python-success-stories',
            defaults={
                'content': content,
                'content_markup_type': 'html',
            }
        )

        # Purge Fastly cache
        purge_url('/box/supernav-python-success-stories/')

    if instance.is_published:
        # Purge the page itself
        purge_url(instance.get_absolute_url())
github python / pythondotorg / downloads / models.py View on Github external
if kwargs.get('raw', False):
        return

    # Only purge on published instances
    if instance.is_published:
        # Purge our common pages
        purge_url('/downloads/')
        purge_url('/downloads/latest/python2/')
        purge_url('/downloads/latest/python3/')
        purge_url('/downloads/mac-osx/')
        purge_url('/downloads/source/')
        purge_url('/downloads/windows/')
        if instance.get_version() is not None:
            purge_url('/ftp/python/{}/'.format(instance.get_version()))
        # See issue #584 for details
        purge_url('/box/supernav-python-downloads/')
        purge_url('/box/homepage-downloads/')
        purge_url('/box/download-sources/')
        # Purge the release page itself
        purge_url(instance.get_absolute_url())
github python / pythondotorg / downloads / models.py View on Github external
def purge_fastly_download_pages(sender, instance, **kwargs):
    """
    Purge Fastly caches so new Downloads show up more quickly
    """
    # Don't purge on fixture loads
    if kwargs.get('raw', False):
        return

    # Only purge on published instances
    if instance.is_published:
        # Purge our common pages
        purge_url('/downloads/')
        purge_url('/downloads/latest/python2/')
        purge_url('/downloads/latest/python3/')
        purge_url('/downloads/mac-osx/')
        purge_url('/downloads/source/')
        purge_url('/downloads/windows/')
        if instance.get_version() is not None:
            purge_url('/ftp/python/{}/'.format(instance.get_version()))
        # See issue #584 for details
        purge_url('/box/supernav-python-downloads/')
        purge_url('/box/homepage-downloads/')
        purge_url('/box/download-sources/')
        # Purge the release page itself
        purge_url(instance.get_absolute_url())
github python / pythondotorg / downloads / models.py View on Github external
def purge_fastly_download_pages(sender, instance, **kwargs):
    """
    Purge Fastly caches so new Downloads show up more quickly
    """
    # Don't purge on fixture loads
    if kwargs.get('raw', False):
        return

    # Only purge on published instances
    if instance.is_published:
        # Purge our common pages
        purge_url('/downloads/')
        purge_url('/downloads/latest/python2/')
        purge_url('/downloads/latest/python3/')
        purge_url('/downloads/mac-osx/')
        purge_url('/downloads/source/')
        purge_url('/downloads/windows/')
        if instance.get_version() is not None:
            purge_url('/ftp/python/{}/'.format(instance.get_version()))
        # See issue #584 for details
        purge_url('/box/supernav-python-downloads/')
        purge_url('/box/homepage-downloads/')
        purge_url('/box/download-sources/')
        # Purge the release page itself
        purge_url(instance.get_absolute_url())
github python / pythondotorg / downloads / models.py View on Github external
def purge_fastly_download_pages(sender, instance, **kwargs):
    """
    Purge Fastly caches so new Downloads show up more quickly
    """
    # Don't purge on fixture loads
    if kwargs.get('raw', False):
        return

    # Only purge on published instances
    if instance.is_published:
        # Purge our common pages
        purge_url('/downloads/')
        purge_url('/downloads/latest/python2/')
        purge_url('/downloads/latest/python3/')
        purge_url('/downloads/mac-osx/')
        purge_url('/downloads/source/')
        purge_url('/downloads/windows/')
        if instance.get_version() is not None:
            purge_url('/ftp/python/{}/'.format(instance.get_version()))
        # See issue #584 for details
        purge_url('/box/supernav-python-downloads/')
        purge_url('/box/homepage-downloads/')
        purge_url('/box/download-sources/')
        # Purge the release page itself
        purge_url(instance.get_absolute_url())
github python / pythondotorg / downloads / models.py View on Github external
def purge_fastly_download_pages(sender, instance, **kwargs):
    """
    Purge Fastly caches so new Downloads show up more quickly
    """
    # Don't purge on fixture loads
    if kwargs.get('raw', False):
        return

    # Only purge on published instances
    if instance.is_published:
        # Purge our common pages
        purge_url('/downloads/')
        purge_url('/downloads/latest/python2/')
        purge_url('/downloads/latest/python3/')
        purge_url('/downloads/mac-osx/')
        purge_url('/downloads/source/')
        purge_url('/downloads/windows/')
        if instance.get_version() is not None:
            purge_url('/ftp/python/{}/'.format(instance.get_version()))
        # See issue #584 for details
        purge_url('/box/supernav-python-downloads/')
        purge_url('/box/homepage-downloads/')
        purge_url('/box/download-sources/')
        # Purge the release page itself
        purge_url(instance.get_absolute_url())
github python / pythondotorg / jobs / models.py View on Github external
def purge_fastly_cache(sender, instance, **kwargs):
    """
    Purge fastly.com cache on new jobs
    Requires settings.FASTLY_API_KEY being set
    """
    # Skip in fixtures
    if kwargs.get('raw', False):
        return

    if instance.status == Job.STATUS_APPROVED:
        purge_url(reverse('jobs:job_detail', kwargs={'pk': instance.pk}))
        purge_url(reverse('jobs:job_list'))
        purge_url(reverse('jobs:job_rss'))
github python / pythondotorg / downloads / models.py View on Github external
return

    # Only purge on published instances
    if instance.is_published:
        # Purge our common pages
        purge_url('/downloads/')
        purge_url('/downloads/latest/python2/')
        purge_url('/downloads/latest/python3/')
        purge_url('/downloads/mac-osx/')
        purge_url('/downloads/source/')
        purge_url('/downloads/windows/')
        if instance.get_version() is not None:
            purge_url('/ftp/python/{}/'.format(instance.get_version()))
        # See issue #584 for details
        purge_url('/box/supernav-python-downloads/')
        purge_url('/box/homepage-downloads/')
        purge_url('/box/download-sources/')
        # Purge the release page itself
        purge_url(instance.get_absolute_url())
github python / pythondotorg / downloads / models.py View on Github external
if instance.is_published:
        # Purge our common pages
        purge_url('/downloads/')
        purge_url('/downloads/latest/python2/')
        purge_url('/downloads/latest/python3/')
        purge_url('/downloads/mac-osx/')
        purge_url('/downloads/source/')
        purge_url('/downloads/windows/')
        if instance.get_version() is not None:
            purge_url('/ftp/python/{}/'.format(instance.get_version()))
        # See issue #584 for details
        purge_url('/box/supernav-python-downloads/')
        purge_url('/box/homepage-downloads/')
        purge_url('/box/download-sources/')
        # Purge the release page itself
        purge_url(instance.get_absolute_url())