diff --git a/ocr/settings.py b/ocr/settings.py index 74065a5..9259064 100644 --- a/ocr/settings.py +++ b/ocr/settings.py @@ -25,7 +25,7 @@ SECRET_KEY = 'django-insecure-#-a9k=#&y3e&a&@%rn7mhl@fk3smxceqh^@1)#9t@c-qzx&k^b # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ['aiworks.intranet.sumasen.net',] +ALLOWED_HOSTS = ['aiworks.intranet.sumasen.net', 'localhost'] # Application definition @@ -56,7 +56,7 @@ ROOT_URLCONF = 'ocr.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [BASE_DIR / 'templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/sumasen_easyocr/urls.py b/sumasen_easyocr/urls.py index b14f28e..969ccfd 100644 --- a/sumasen_easyocr/urls.py +++ b/sumasen_easyocr/urls.py @@ -1,7 +1,8 @@ from django.contrib import admin from django.urls import path, re_path -from .views import FileUploadView +from .views import FileUploadView, UploaderView urlpatterns = [ - re_path(r'^upload/', FileUploadView.as_view()) + re_path(r'^upload/', FileUploadView.as_view()), + path('uploader/', UploaderView, name="uploader") ] diff --git a/sumasen_easyocr/views.py b/sumasen_easyocr/views.py index 91826a1..c0c88c6 100644 --- a/sumasen_easyocr/views.py +++ b/sumasen_easyocr/views.py @@ -1,9 +1,13 @@ +from django.shortcuts import render from rest_framework.views import APIView from rest_framework.parsers import MultiPartParser from rest_framework.response import Response from rest_framework import status import easyocr +def UploaderView(request): + return render(request, 'sumasen_easyocr/index.html') + class FileUploadView(APIView): parser_classes = [MultiPartParser,] diff --git a/templates/sumasen_easyocr/index.html b/templates/sumasen_easyocr/index.html new file mode 100644 index 0000000..4710b1d --- /dev/null +++ b/templates/sumasen_easyocr/index.html @@ -0,0 +1,23 @@ + + + +
+ + + + + +