This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import graphene | |
from .queries import Query | |
from .mutations import Mutation | |
schema = graphene.Schema(query=Query, mutation=Mutation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from graphene import ObjectType, Schema | |
from app.info.graphql.schema import Query as InfoQuery | |
from app.info.graphql.schema import Mutation as InfoMutation | |
class Query(InfoQuery, ObjectType): | |
# This class will inherit from multiple Queries | |
# as we begin to add more apps to our project | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Application definition | |
INSTALLED_APPS = [ | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
# libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from graphene_django.views import GraphQLView | |
from django.contrib import admin | |
from django.urls import path | |
from django.views.decorators.csrf import csrf_exempt | |
urlpatterns = [ | |
path('admin/', admin.site.urls), | |
path('graphql/', csrf_exempt(GraphQLView.as_view())), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Author(models.Model): | |
name = models.CharField(max_length=100) | |
def __str__(self): | |
return self.name | |
class Meta: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_presigned_url(): | |
s3 = boto3.client('s3') | |
bucket = "your-s3-bucket-name" | |
return s3.generate_presigned_post( | |
Bucket=bucket, | |
Key="media/screenshots/login.png", | |
Fields={"acl": "public-read", "Content-Type": "png"}, | |
Conditions=[ | |
{"acl": "public-read"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print 'hello world' |
NewerOlder