Add blocking view
This commit is contained in:
parent
b243037433
commit
88cfa79b97
Binary file not shown.
|
|
@ -688,14 +688,12 @@ else:
|
||||||
"DATATRANS_PAY_URL", default="https://pay.sandbox.datatrans.com"
|
"DATATRANS_PAY_URL", default="https://pay.sandbox.datatrans.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# default settings for python sftpserver test-server
|
# default settings for python sftpserver test-server
|
||||||
ABACUS_EXPORT_SFTP_HOST = env("ABACUS_EXPORT_SFTP_HOST", default="localhost")
|
ABACUS_EXPORT_SFTP_HOST = env("ABACUS_EXPORT_SFTP_HOST", default="localhost")
|
||||||
ABACUS_EXPORT_SFTP_PASSWORD = env("ABACUS_EXPORT_SFTP_PASSWORD", default="admin")
|
ABACUS_EXPORT_SFTP_PASSWORD = env("ABACUS_EXPORT_SFTP_PASSWORD", default="admin")
|
||||||
ABACUS_EXPORT_SFTP_PORT = env("ABACUS_EXPORT_SFTP_PORT", default="3373")
|
ABACUS_EXPORT_SFTP_PORT = env("ABACUS_EXPORT_SFTP_PORT", default="3373")
|
||||||
ABACUS_EXPORT_SFTP_USERNAME = env("ABACUS_EXPORT_SFTP_USERNAME", default="admin")
|
ABACUS_EXPORT_SFTP_USERNAME = env("ABACUS_EXPORT_SFTP_USERNAME", default="admin")
|
||||||
|
|
||||||
|
|
||||||
# S3 BUCKET CONFIGURATION
|
# S3 BUCKET CONFIGURATION
|
||||||
FILE_UPLOAD_STORAGE = env("FILE_UPLOAD_STORAGE", default="s3") # local | s3
|
FILE_UPLOAD_STORAGE = env("FILE_UPLOAD_STORAGE", default="s3") # local | s3
|
||||||
|
|
||||||
|
|
@ -753,6 +751,8 @@ CONSTANCE_CONFIG = {
|
||||||
}
|
}
|
||||||
TRACKING_TAG = env("IT_TRACKING_TAG", default="")
|
TRACKING_TAG = env("IT_TRACKING_TAG", default="")
|
||||||
|
|
||||||
|
DEBUG_TOOLS = env.bool("IT_DEBUG_TOOLS", default=False)
|
||||||
|
|
||||||
if APP_ENVIRONMENT == "local":
|
if APP_ENVIRONMENT == "local":
|
||||||
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
|
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
|
||||||
INSTALLED_APPS = ["whitenoise.runserver_nostatic"] + INSTALLED_APPS # noqa F405
|
INSTALLED_APPS = ["whitenoise.runserver_nostatic"] + INSTALLED_APPS # noqa F405
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ from vbv_lernwelt.dashboard.views import (
|
||||||
get_mentee_count,
|
get_mentee_count,
|
||||||
get_mentor_open_tasks_count,
|
get_mentor_open_tasks_count,
|
||||||
)
|
)
|
||||||
|
from vbv_lernwelt.debugtools.views import async_blocking_view, blocking_view
|
||||||
from vbv_lernwelt.edoniq_test.views import (
|
from vbv_lernwelt.edoniq_test.views import (
|
||||||
export_students,
|
export_students,
|
||||||
export_students_and_trainers,
|
export_students_and_trainers,
|
||||||
|
|
@ -68,7 +69,6 @@ from vbv_lernwelt.importer.views import (
|
||||||
)
|
)
|
||||||
from vbv_lernwelt.media_files.views import user_image
|
from vbv_lernwelt.media_files.views import user_image
|
||||||
from vbv_lernwelt.notify.views import email_notification_settings
|
from vbv_lernwelt.notify.views import email_notification_settings
|
||||||
|
|
||||||
from vbv_lernwelt.shop.datatrans.datatrans_fake_server import (
|
from vbv_lernwelt.shop.datatrans.datatrans_fake_server import (
|
||||||
fake_datatrans_api_view,
|
fake_datatrans_api_view,
|
||||||
fake_datatrans_pay_view,
|
fake_datatrans_pay_view,
|
||||||
|
|
@ -265,6 +265,14 @@ if "fakeapi" in settings.DATATRANS_API_ENDPOINT:
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if settings.DEBUG_TOOLS:
|
||||||
|
urlpatterns += [
|
||||||
|
re_path(r'server/debugtools/blocking/$', blocking_view,
|
||||||
|
name='blocking_view'),
|
||||||
|
re_path(r'server/debugtools/async-blocking/$', async_blocking_view,
|
||||||
|
name='async_blocking_view'),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
import asyncio
|
||||||
|
import time
|
||||||
|
|
||||||
|
import structlog
|
||||||
|
from django.db import transaction
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
logger = structlog.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def blocking_view(request):
|
||||||
|
logger.info("blocking view start", label="debugtools", tool="blocking_view")
|
||||||
|
time.sleep(10)
|
||||||
|
logger.info("blocking view end", label="debugtools", tool="blocking_view")
|
||||||
|
return HttpResponse("Done")
|
||||||
|
|
||||||
|
|
||||||
|
@transaction.non_atomic_requests
|
||||||
|
async def async_blocking_view(request):
|
||||||
|
logger.info("async_blocking view start", label="debugtools", tool="blocking_view")
|
||||||
|
await asyncio.sleep(10)
|
||||||
|
logger.info("async_blocking view end", label="debugtools", tool="blocking_view")
|
||||||
|
return HttpResponse("aDone")
|
||||||
Loading…
Reference in New Issue