Skip to content

Instantly share code, notes, and snippets.

@aitoehigie
Created October 13, 2018 02:01
Show Gist options
  • Save aitoehigie/ebcc1d3e460e66cd51e5501fa2636798 to your computer and use it in GitHub Desktop.
Save aitoehigie/ebcc1d3e460e66cd51e5501fa2636798 to your computer and use it in GitHub Desktop.
import sys
from django.conf import settings
settings.configure(
DEBUG=True,
SECRET_KEY='thisisthesecretkey',
ROOT_URLCONF=__name__,
MIDDLEWARE_CLASSES=(
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
),
)
from django.urls import path
from django.http import HttpResponse
def index(request):
return HttpResponse('Hello World')
urlpatterns = (
path('', index),
)
if __name__ == "__main__":
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
@funkybob
Copy link

I don't believe any of those middlwares are necessary [but, of course, keep them if the other frameworks are providing comparable functions]

Which WSGI / ASGI server are you using in each case?

@aitoehigie
Copy link
Author

aitoehigie commented Oct 13, 2018

@funkybob, can you remove the middleware to check if the app would still run? Presently can't ascertain that at the moment. I am currently using the wsgi server that comes with each framework. On second thought, I don't think that is fair as some inbuilt servers are slower than others. I will update the tests to use gunicorn for wsgi and uvicorn for ASGI.

@NekoTashi
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment