Skip to content

Instantly share code, notes, and snippets.

@thenationofalex
thenationofalex / settings.py
Created November 12, 2016 10:16
Load Google service account keys from a file in Python/Django
#!/usr/bin/env python3
import os
...
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = os.path.join(BASE_DIR, 'google-service-account-key.json')
@thenationofalex
thenationofalex / graphql-upload-file-mutation.py
Created October 29, 2016 10:57
GraphQL/Graphene Django - Uploading files.
#!/usr/bin/env python3
'''
Since Django's request isn't avaliable to graphene's mutation def.
It is passed in via context.
'''
import graphene
from .models import Users
class UploadMutation(graphene.Mutation):