Merge branch '4-mongodb_api'
This commit is contained in:
commit
24a139e8c8
@ -42,7 +42,7 @@ def get_image(identifier):
|
||||
print("Getting image with identifier "+identifier)
|
||||
|
||||
baseurl = "http://127.0.0.1:8000"
|
||||
get_url = "/image/get?id="+identifier
|
||||
get_url = "/image/get/"+identifier
|
||||
|
||||
try:
|
||||
response = requests.get(baseurl + get_url)
|
||||
@ -57,7 +57,7 @@ def get_all():
|
||||
print("Getting all images")
|
||||
|
||||
baseurl = "http://127.0.0.1:8000"
|
||||
get_url = "/image/get"
|
||||
get_url = "/image/get/all"
|
||||
|
||||
try:
|
||||
response = requests.get(baseurl + get_url)
|
||||
|
||||
@ -15,7 +15,7 @@ Including another URLconf
|
||||
"""
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import path, re_path
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
from app_be.views.rest_api import TestApiClass, ImageEndpoint
|
||||
@ -23,8 +23,8 @@ from app_be.views.rest_api import TestApiClass, ImageEndpoint
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
url(r'^test/', TestApiClass.test_api),
|
||||
url(r'^image/get$', ImageEndpoint.image_api_get_all),
|
||||
url(r'^image/get(?P<id>[-|a-zA-Z0-9]+)$', ImageEndpoint.image_api_get_single),
|
||||
url(r'^image/get/all$', ImageEndpoint.image_api_get_all),
|
||||
url(r'^image/get/(?P<id>[\w-]+)$', ImageEndpoint.image_api_get_single),
|
||||
url(r'^image/post$', ImageEndpoint.image_api_post)
|
||||
]
|
||||
|
||||
|
||||
@ -28,15 +28,13 @@ class ImageEndpoint:
|
||||
@api_view(['GET'])
|
||||
def image_api_get_all(request):
|
||||
logger.debug('Image GET all call: {}'.format(request))
|
||||
print(request)
|
||||
|
||||
instance = MongoManager.getInstance()
|
||||
|
||||
db = instance.AIC
|
||||
col = db.metadata
|
||||
|
||||
print("hier")
|
||||
|
||||
|
||||
try:
|
||||
for resp in col.find():
|
||||
print(resp)
|
||||
@ -52,8 +50,6 @@ class ImageEndpoint:
|
||||
def image_api_get_single(request, id):
|
||||
logger.debug('Image GET single call: {}'.format(request))
|
||||
|
||||
print("im single")
|
||||
|
||||
instance = MongoManager.getInstance()
|
||||
|
||||
db = instance.AIC
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user