├── hackernews ├── links │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0004_auto_20180121_1031.py │ │ ├── 0001_initial.py │ │ ├── 0002_link_posted_by.py │ │ └── 0003_vote.py │ ├── apps.py │ ├── models.py │ ├── schema_relay.py │ └── schema.py ├── users │ ├── __init__.py │ ├── apps.py │ └── schema.py ├── hackernews │ ├── __init__.py │ ├── wsgi.py │ ├── schema.py │ ├── urls.py │ └── settings.py └── manage.py ├── requirements.txt ├── README.md ├── LICENSE └── .gitignore /hackernews/links/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hackernews/users/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hackernews/hackernews/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hackernews/links/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django==2.2 2 | django-filter==2.1.0 3 | django-graphql-jwt==0.2.1 4 | graphene-django==2.2.0 5 | -------------------------------------------------------------------------------- /hackernews/links/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class LinksConfig(AppConfig): 5 | name = 'links' 6 | -------------------------------------------------------------------------------- /hackernews/users/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class UsersConfig(AppConfig): 5 | name = 'users' 6 | -------------------------------------------------------------------------------- /hackernews/hackernews/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for hackernews project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hackernews.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /hackernews/links/migrations/0004_auto_20180121_1031.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0 on 2018-01-21 10:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('links', '0003_vote'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='link', 15 | name='description', 16 | field=models.TextField(blank=True, default=''), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /hackernews/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hackernews.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /hackernews/links/models.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import models 3 | 4 | 5 | class Link(models.Model): 6 | url = models.URLField() 7 | description = models.TextField(blank=True) 8 | posted_by = models.ForeignKey( 9 | settings.AUTH_USER_MODEL, 10 | null=True, 11 | on_delete=models.CASCADE) 12 | 13 | 14 | class Vote(models.Model): 15 | user = models.ForeignKey( 16 | settings.AUTH_USER_MODEL, 17 | on_delete=models.CASCADE) 18 | 19 | link = models.ForeignKey( 20 | 'links.Link', 21 | related_name='votes', 22 | on_delete=models.CASCADE) 23 | -------------------------------------------------------------------------------- /hackernews/links/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0 on 2017-12-03 18:57 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Link', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('url', models.URLField()), 19 | ('description', models.TextField(blank=True, null=True)), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /hackernews/links/migrations/0002_link_posted_by.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0 on 2017-12-03 19:48 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 12 | ('links', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name='link', 18 | name='posted_by', 19 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /hackernews/hackernews/schema.py: -------------------------------------------------------------------------------- 1 | import graphene 2 | import graphql_jwt 3 | 4 | import links.schema 5 | import links.schema_relay 6 | import users.schema 7 | 8 | 9 | class Query( 10 | users.schema.Query, 11 | links.schema.Query, 12 | links.schema_relay.RelayQuery, 13 | graphene.ObjectType, 14 | ): 15 | pass 16 | 17 | 18 | class Mutation( 19 | users.schema.Mutation, 20 | links.schema.Mutation, 21 | links.schema_relay.RelayMutation, 22 | graphene.ObjectType, 23 | ): 24 | 25 | token_auth = graphql_jwt.ObtainJSONWebToken.Field() 26 | verify_token = graphql_jwt.Verify.Field() 27 | refresh_token = graphql_jwt.Refresh.Field() 28 | 29 | 30 | schema = graphene.Schema(query=Query, mutation=Mutation) 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # graphql-python 2 | A Hacketnews project developed for the [How to GraphQL tutorial](https://www.howtographql.com/graphql-python/0-introduction/) using Python, Django and Graphene. Tested on Python 3.6. 3 | 4 | ## Installation and Usage 5 | Clone the project. 6 | 7 | Create a virtual environment: 8 | ```bash 9 | python3.6 -m venv venv 10 | source venv/bin/activate 11 | ``` 12 | 13 | Install everything needed: 14 | ```bash 15 | pip install -r requirements.txt 16 | ``` 17 | 18 | Create the database and run the server: 19 | ``` 20 | python hackernews/manage.py migrate 21 | python hackernews/manage.py runserver 22 | ``` 23 | 24 | You should be able to access the server on [here](http://localhost:8000/graphql). 25 | 26 | To get the most of the project, please read the [tutorial](https://www.howtographql.com/graphql-python/0-introduction/). 27 | -------------------------------------------------------------------------------- /hackernews/links/migrations/0003_vote.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0 on 2017-12-03 19:53 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 12 | ('links', '0002_link_posted_by'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Vote', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('link', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='votes', to='links.Link')), 21 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /hackernews/hackernews/urls.py: -------------------------------------------------------------------------------- 1 | """hackernews URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from django.views.decorators.csrf import csrf_exempt 19 | 20 | from graphene_django.views import GraphQLView 21 | 22 | urlpatterns = [ 23 | path('admin/', admin.site.urls), 24 | path('graphql/', csrf_exempt(GraphQLView.as_view(graphiql=True))), 25 | ] 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 How to GraphQL 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /hackernews/users/schema.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import get_user_model 2 | 3 | import graphene 4 | from graphene_django import DjangoObjectType 5 | 6 | 7 | class UserType(DjangoObjectType): 8 | class Meta: 9 | model = get_user_model() 10 | 11 | 12 | class CreateUser(graphene.Mutation): 13 | user = graphene.Field(UserType) 14 | 15 | class Arguments: 16 | username = graphene.String(required=True) 17 | password = graphene.String(required=True) 18 | email = graphene.String(required=True) 19 | 20 | def mutate(self, info, username, password, email): 21 | user = get_user_model()( 22 | username=username, 23 | email=email, 24 | ) 25 | user.set_password(password) 26 | user.save() 27 | 28 | return CreateUser(user=user) 29 | 30 | 31 | class Mutation(graphene.ObjectType): 32 | create_user = CreateUser.Field() 33 | 34 | 35 | class Query(graphene.ObjectType): 36 | me = graphene.Field(UserType) 37 | users = graphene.List(UserType) 38 | 39 | def resolve_users(self, info): 40 | return get_user_model().objects.all() 41 | 42 | def resolve_me(self, info): 43 | user = info.context.user 44 | if user.is_anonymous: 45 | raise Exception('Not logged!') 46 | return user 47 | -------------------------------------------------------------------------------- /hackernews/links/schema_relay.py: -------------------------------------------------------------------------------- 1 | import django_filters 2 | import graphene 3 | from graphene_django import DjangoObjectType 4 | from graphene_django.filter import DjangoFilterConnectionField 5 | 6 | from .models import Link, Vote 7 | 8 | 9 | class LinkFilter(django_filters.FilterSet): 10 | class Meta: 11 | model = Link 12 | fields = ['url', 'description'] 13 | 14 | 15 | class LinkNode(DjangoObjectType): 16 | class Meta: 17 | model = Link 18 | interfaces = (graphene.relay.Node, ) 19 | 20 | 21 | class VoteNode(DjangoObjectType): 22 | class Meta: 23 | model = Vote 24 | interfaces = (graphene.relay.Node,) 25 | 26 | 27 | class RelayQuery(graphene.ObjectType): 28 | relay_link = graphene.relay.Node.Field(LinkNode) 29 | relay_links = DjangoFilterConnectionField(LinkNode, filterset_class=LinkFilter) 30 | 31 | 32 | class RelayCreateLink(graphene.relay.ClientIDMutation): 33 | link = graphene.Field(LinkNode) 34 | 35 | class Input: 36 | url = graphene.String() 37 | description = graphene.String() 38 | 39 | def mutate_and_get_payload(root, info, **input): 40 | user = info.context.user 41 | 42 | link = Link( 43 | url=input.get('url'), 44 | description=input.get('description'), 45 | posted_by=user, 46 | ) 47 | link.save() 48 | 49 | return RelayCreateLink(link=link) 50 | 51 | 52 | class RelayMutation(graphene.ObjectType): 53 | relay_create_link = RelayCreateLink.Field() 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | 103 | # db 104 | hackernews/db.sqlite3 105 | -------------------------------------------------------------------------------- /hackernews/links/schema.py: -------------------------------------------------------------------------------- 1 | from django.db.models import Q 2 | 3 | import graphene 4 | from graphene_django import DjangoObjectType 5 | from graphql import GraphQLError 6 | 7 | from users.schema import UserType 8 | 9 | from .models import Link, Vote 10 | 11 | 12 | class LinkType(DjangoObjectType): 13 | class Meta: 14 | model = Link 15 | 16 | 17 | class VoteType(DjangoObjectType): 18 | class Meta: 19 | model = Vote 20 | 21 | 22 | class Query(graphene.ObjectType): 23 | links = graphene.List( 24 | LinkType, 25 | search=graphene.String(), 26 | first=graphene.Int(), 27 | skip=graphene.Int(), 28 | ) 29 | votes = graphene.List(VoteType) 30 | 31 | def resolve_links(self, info, search=None, first=None, skip=None, **kwargs): 32 | qs = Link.objects.all() 33 | 34 | if search: 35 | filter = ( 36 | Q(url__icontains=search) | 37 | Q(description__icontains=search) 38 | ) 39 | qs = qs.filter(filter) 40 | 41 | if skip: 42 | qs = qs[skip::] 43 | 44 | if first: 45 | qs = qs[:first] 46 | 47 | return qs 48 | 49 | def resolve_votes(self, info, **kwargs): 50 | return Vote.objects.all() 51 | 52 | 53 | class CreateLink(graphene.Mutation): 54 | id = graphene.Int() 55 | url = graphene.String() 56 | description = graphene.String() 57 | posted_by = graphene.Field(UserType) 58 | 59 | class Arguments: 60 | url = graphene.String() 61 | description = graphene.String() 62 | 63 | def mutate(self, info, url, description): 64 | user = info.context.user 65 | link = Link( 66 | url=url, 67 | description=description, 68 | posted_by=user, 69 | ) 70 | link.save() 71 | 72 | return CreateLink( 73 | id=link.id, 74 | url=link.url, 75 | description=link.description, 76 | posted_by=link.posted_by, 77 | ) 78 | 79 | 80 | class CreateVote(graphene.Mutation): 81 | user = graphene.Field(UserType) 82 | link = graphene.Field(LinkType) 83 | 84 | class Arguments: 85 | link_id = graphene.Int() 86 | 87 | def mutate(self, info, link_id): 88 | user = info.context.user 89 | if user.is_anonymous: 90 | raise GraphQLError('You must be logged in to vote!') 91 | 92 | link = Link.objects.filter(id=link_id).first() 93 | if not link: 94 | raise Exception('Invalid Link!') 95 | 96 | Vote.objects.create( 97 | user=user, 98 | link=link, 99 | ) 100 | 101 | return CreateVote(user=user, link=link) 102 | 103 | 104 | class Mutation(graphene.ObjectType): 105 | create_link = CreateLink.Field() 106 | create_vote = CreateVote.Field() 107 | -------------------------------------------------------------------------------- /hackernews/hackernews/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for hackernews project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.0. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'uc$3f*&ihhr6*xzhio17991*3&-jkovrwnufq&r#heef@j*8ow' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'graphene_django', 41 | 'links', 42 | 'users', 43 | ] 44 | 45 | MIDDLEWARE = [ 46 | 'django.middleware.security.SecurityMiddleware', 47 | 'django.contrib.sessions.middleware.SessionMiddleware', 48 | 'django.middleware.common.CommonMiddleware', 49 | 'django.middleware.csrf.CsrfViewMiddleware', 50 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 51 | 'django.contrib.messages.middleware.MessageMiddleware', 52 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 53 | ] 54 | 55 | ROOT_URLCONF = 'hackernews.urls' 56 | 57 | TEMPLATES = [ 58 | { 59 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 60 | 'DIRS': [], 61 | 'APP_DIRS': True, 62 | 'OPTIONS': { 63 | 'context_processors': [ 64 | 'django.template.context_processors.debug', 65 | 'django.template.context_processors.request', 66 | 'django.contrib.auth.context_processors.auth', 67 | 'django.contrib.messages.context_processors.messages', 68 | ], 69 | }, 70 | }, 71 | ] 72 | 73 | WSGI_APPLICATION = 'hackernews.wsgi.application' 74 | 75 | 76 | # Database 77 | # https://docs.djangoproject.com/en/2.0/ref/settings/#databases 78 | 79 | DATABASES = { 80 | 'default': { 81 | 'ENGINE': 'django.db.backends.sqlite3', 82 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 83 | }, 84 | } 85 | 86 | 87 | # Password validation 88 | # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators 89 | 90 | AUTH_PASSWORD_VALIDATORS = [ 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 93 | }, 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 99 | }, 100 | { 101 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 102 | }, 103 | ] 104 | 105 | 106 | # Authentication 107 | # https://docs.djangoproject.com/en/2.0/ref/contrib/auth/#authentication-backends-reference 108 | 109 | AUTHENTICATION_BACKENDS = [ 110 | 'graphql_jwt.backends.JSONWebTokenBackend', 111 | 'django.contrib.auth.backends.ModelBackend', 112 | ] 113 | 114 | 115 | # Internationalization 116 | # https://docs.djangoproject.com/en/2.0/topics/i18n/ 117 | 118 | LANGUAGE_CODE = 'en-us' 119 | 120 | TIME_ZONE = 'UTC' 121 | 122 | USE_I18N = True 123 | 124 | USE_L10N = True 125 | 126 | USE_TZ = True 127 | 128 | 129 | # Static files (CSS, JavaScript, Images) 130 | # https://docs.djangoproject.com/en/2.0/howto/static-files/ 131 | 132 | STATIC_URL = '/static/' 133 | 134 | GRAPHENE = { 135 | 'SCHEMA': 'hackernews.schema.schema', 136 | 'MIDDLEWARE': [ 137 | 'graphql_jwt.middleware.JSONWebTokenMiddleware', 138 | ], 139 | } 140 | --------------------------------------------------------------------------------