Skip to content

Instantly share code, notes, and snippets.

@andersk
Last active Apr 8, 2022
Embed
What would you like to do?
#!/usr/bin/env python
import os
import sys
from django.core.management import execute_from_command_line
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mctest_settings")
execute_from_command_line(sys.argv)
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mctest_settings")
application = get_asgi_application()
DEBUG = True
SECRET_KEY = "sekrit"
ROOT_URLCONF = "mctest_urls"
WSGI_APPLICATION = "mctest_wsgi.application"
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.memcached.PyLibMCCache",
"LOCATION": "127.0.0.1:11211",
}
}
from django.core.cache import cache
from django.http import HttpResponse
from django.urls import path
def view(request):
cache.set("foo", "ok")
return HttpResponse(cache.get("foo"))
urlpatterns = [path("", view)]
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mctest_settings")
application = get_wsgi_application()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment