commit 1d6d68a32f571db76ccb7da0c2a4d02aa30cf6c6 Author: ilvas Date: Mon Jan 4 23:25:59 2021 +0300 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..28626b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/db.sqlite3 +/movies.json \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/evgenApp.iml b/.idea/evgenApp.iml new file mode 100644 index 0000000..6b89cd6 --- /dev/null +++ b/.idea/evgenApp.iml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d1e22ec --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f47e4bf --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..0d4a33c --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1609460506495 + + + + \ No newline at end of file diff --git a/evgen-app-ui b/evgen-app-ui new file mode 160000 index 0000000..4be809b --- /dev/null +++ b/evgen-app-ui @@ -0,0 +1 @@ +Subproject commit 4be809b3dbdfa14caf3adc6a5b5024a163ee3b8b diff --git a/evgenApp/__init__.py b/evgenApp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/evgenApp/__pycache__/__init__.cpython-36.pyc b/evgenApp/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..d6c5c28 Binary files /dev/null and b/evgenApp/__pycache__/__init__.cpython-36.pyc differ diff --git a/evgenApp/__pycache__/schema.cpython-36.pyc b/evgenApp/__pycache__/schema.cpython-36.pyc new file mode 100644 index 0000000..6ef9f53 Binary files /dev/null and b/evgenApp/__pycache__/schema.cpython-36.pyc differ diff --git a/evgenApp/__pycache__/settings.cpython-36.pyc b/evgenApp/__pycache__/settings.cpython-36.pyc new file mode 100644 index 0000000..0ffb747 Binary files /dev/null and b/evgenApp/__pycache__/settings.cpython-36.pyc differ diff --git a/evgenApp/__pycache__/urls.cpython-36.pyc b/evgenApp/__pycache__/urls.cpython-36.pyc new file mode 100644 index 0000000..ce745ab Binary files /dev/null and b/evgenApp/__pycache__/urls.cpython-36.pyc differ diff --git a/evgenApp/__pycache__/wsgi.cpython-36.pyc b/evgenApp/__pycache__/wsgi.cpython-36.pyc new file mode 100644 index 0000000..5ad10b7 Binary files /dev/null and b/evgenApp/__pycache__/wsgi.cpython-36.pyc differ diff --git a/evgenApp/schema.py b/evgenApp/schema.py new file mode 100644 index 0000000..d674c23 --- /dev/null +++ b/evgenApp/schema.py @@ -0,0 +1,8 @@ +import graphene +import users.schema + +class Query(users.schema.Query, graphene.ObjectType): + pass + + +schema = graphene.Schema(query=Query) \ No newline at end of file diff --git a/evgenApp/settings.py b/evgenApp/settings.py new file mode 100644 index 0000000..74b20c7 --- /dev/null +++ b/evgenApp/settings.py @@ -0,0 +1,139 @@ +""" +Django settings for evgenApp project. + +Generated by 'django-admin startproject' using Django 2.0. + +For more information on this file, see +https://docs.djangoproject.com/en/2.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '&%x4%0rf7_^)by!jrj23_e^*_ov(rv9+!=4a*rx)g)zr1^)4q=' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'graphene_django', + 'corsheaders', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] +GRAPHENE = { + 'SCHEMA': 'evgenApp.schema.schema' +} + +CORS_ORIGIN_ALLOW_ALL = False + +CORS_ORIGIN_WHITELIST = ( + 'localhost:3000', +) + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'corsheaders.middleware.CorsMiddleware', + 'django.middleware.common.CommonMiddleware', +] + +CORS_ORIGIN_WHITELIST = [ + "http://localhost:3000", + "http://127.0.0.1:3000" + # your React App domain +] + +ROOT_URLCONF = 'evgenApp.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'evgenApp.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/2.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.0/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/evgenApp/urls.py b/evgenApp/urls.py new file mode 100644 index 0000000..fde819e --- /dev/null +++ b/evgenApp/urls.py @@ -0,0 +1,33 @@ +"""evgenApp URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/2.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path + +from graphene_django.views import GraphQLView +from django.views.decorators.csrf import csrf_exempt + +from django.http import HttpResponse + +from django.shortcuts import redirect + +def f(req): + return HttpResponse("hello") + +urlpatterns = [ + path('admin/', admin.site.urls), + path("graphql/", csrf_exempt(GraphQLView.as_view(graphiql=True)), name="gq"), + path("", lambda x : redirect("gq")) +] diff --git a/evgenApp/wsgi.py b/evgenApp/wsgi.py new file mode 100644 index 0000000..2c58c2c --- /dev/null +++ b/evgenApp/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for evgenApp project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "evgenApp.settings") + +application = get_wsgi_application() diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..8aa3d67 --- /dev/null +++ b/manage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "evgenApp.settings") + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) diff --git a/users/__init__.py b/users/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/users/__pycache__/__init__.cpython-36.pyc b/users/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..14a0541 Binary files /dev/null and b/users/__pycache__/__init__.cpython-36.pyc differ diff --git a/users/__pycache__/schema.cpython-36.pyc b/users/__pycache__/schema.cpython-36.pyc new file mode 100644 index 0000000..557282e Binary files /dev/null and b/users/__pycache__/schema.cpython-36.pyc differ diff --git a/users/admin.py b/users/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/users/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/users/apps.py b/users/apps.py new file mode 100644 index 0000000..4ce1fab --- /dev/null +++ b/users/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class UsersConfig(AppConfig): + name = 'users' diff --git a/users/migrations/__init__.py b/users/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/users/models.py b/users/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/users/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/users/schema.py b/users/schema.py new file mode 100644 index 0000000..d7dfaa5 --- /dev/null +++ b/users/schema.py @@ -0,0 +1,9 @@ +import graphene + +class Query(graphene.ObjectType): + hello = graphene.Field(graphene.String) + + def resolve_hello(self, info): + return "hello" + +schema = graphene.Schema(query=Query) \ No newline at end of file diff --git a/users/tests.py b/users/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/users/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/users/views.py b/users/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/users/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.