Skip to content

Commit 8c318c1

Browse files
authored
Merge pull request #2 from dmutende/master
Update
2 parents 9aab399 + f1962c9 commit 8c318c1

22 files changed

Lines changed: 314 additions & 0 deletions

backend/.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
omit = manage.py, *wsgi.py, *test_settings.py, *settings.py, *urls.py, *__init__.py, */apps.py, */tests/*, */migrations/*

backend/backend/__init__.py

Whitespace-only changes.

backend/backend/schema.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import graphene
2+
import simple_app.schema
3+
4+
5+
class Queries(
6+
simple_app.schema.Query,
7+
graphene.ObjectType
8+
):
9+
dummy = graphene.String()
10+
11+
12+
schema = graphene.Schema(query=Queries)

backend/backend/settings.py

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
"""
2+
Django settings for backend project.
3+
4+
Generated by 'django-admin startproject' using Django 2.0.1.
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 = 'zp87j$e*2@qmkeu26kzevw-07=rtac0t25-%0w@==9h#c@^b+b'
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+
'simple_app',
41+
'graphene_django',
42+
]
43+
44+
GRAPHENE = {
45+
'SCHEMA': 'backend.schema.schema',
46+
}
47+
48+
MIDDLEWARE = [
49+
'django.middleware.security.SecurityMiddleware',
50+
'django.contrib.sessions.middleware.SessionMiddleware',
51+
'django.middleware.common.CommonMiddleware',
52+
'django.middleware.csrf.CsrfViewMiddleware',
53+
'django.contrib.auth.middleware.AuthenticationMiddleware',
54+
'django.contrib.messages.middleware.MessageMiddleware',
55+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
56+
]
57+
58+
ROOT_URLCONF = 'backend.urls'
59+
60+
TEMPLATES = [
61+
{
62+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
63+
'DIRS': [],
64+
'APP_DIRS': True,
65+
'OPTIONS': {
66+
'context_processors': [
67+
'django.template.context_processors.debug',
68+
'django.template.context_processors.request',
69+
'django.contrib.auth.context_processors.auth',
70+
'django.contrib.messages.context_processors.messages',
71+
],
72+
},
73+
},
74+
]
75+
76+
WSGI_APPLICATION = 'backend.wsgi.application'
77+
78+
79+
# Database
80+
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
81+
82+
DATABASES = {
83+
'default': {
84+
'ENGINE': 'django.db.backends.sqlite3',
85+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
86+
}
87+
}
88+
89+
90+
# Password validation
91+
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
92+
93+
AUTH_PASSWORD_VALIDATORS = [
94+
{
95+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
96+
},
97+
{
98+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
99+
},
100+
{
101+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
102+
},
103+
{
104+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
105+
},
106+
]
107+
108+
109+
# Internationalization
110+
# https://docs.djangoproject.com/en/2.0/topics/i18n/
111+
112+
LANGUAGE_CODE = 'en-us'
113+
114+
TIME_ZONE = 'UTC'
115+
116+
USE_I18N = True
117+
118+
USE_L10N = True
119+
120+
USE_TZ = True
121+
122+
123+
# Static files (CSS, JavaScript, Images)
124+
# https://docs.djangoproject.com/en/2.0/howto/static-files/
125+
126+
STATIC_URL = '/static/'

backend/backend/test_settings.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from .settings import * # NOQA
2+
3+
DATABASES = {
4+
'default': {
5+
'ENGINE': 'django.db.backends.sqlite3',
6+
'NAME': ':memory:',
7+
}
8+
}
9+
10+
PASSWORD_HASHERS = (
11+
'django.contrib.auth.hashers.MD5PasswordHasher',
12+
)
13+
14+
DEFAULT_FILE_STORAGE = 'inmemorystorage.InMemoryStorage'

backend/backend/urls.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""backend 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.conf.urls import url
17+
from django.contrib import admin
18+
from django.views.decorators.csrf import csrf_exempt
19+
20+
from graphene_django.views import GraphQLView
21+
22+
23+
urlpatterns = [
24+
url(r'^admin/', admin.site.urls),
25+
url(r'^graphiql', csrf_exempt(GraphQLView.as_view(graphiql=True))),
26+
url(r'^elon-graphs', csrf_exempt(GraphQLView.as_view(batch=True))),
27+
]

backend/backend/wsgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for backend 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", "backend.settings")
15+
16+
application = get_wsgi_application()

backend/db.sqlite3

136 KB
Binary file not shown.

backend/manage.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == "__main__":
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backend.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+
) from exc
15+
execute_from_command_line(sys.argv)

backend/pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
DJANGO_SETTINGS_MODULE = backend.test_settings

0 commit comments

Comments
 (0)