sessions.base_session.BaseSessionManager.save()

save(session_key, session_dict, expire_date) Saves session data for a provided session key, or deletes the session in case the data is empty.

sessions.middleware.SessionMiddleware

class SessionMiddleware [source] Enables session support. See the session documentation.

sessions.serializers.JSONSerializer

class serializers.JSONSerializer A wrapper around the JSON serializer from django.core.signing. Can only serialize basic data types. In addition, as JSON supports only string keys, note that using non-string keys in request.session won’t work as expected: >>> # initial assignment >>> request.session[0] = 'bar' >>> # subsequent requests following serialization & deserialization >>> # of session data >>> request.session[0] # KeyError >>&g

sessions.serializers.PickleSerializer

class serializers.PickleSerializer Supports arbitrary Python objects, but, as described above, can lead to a remote code execution vulnerability if SECRET_KEY becomes known by an attacker.

Settings

Core Settings Auth Messages Sessions Sites Static Files Core Settings Topical Index Warning Be careful when you override settings, especially when the default value is a non-empty list or dictionary, such as MIDDLEWARE_CLASSES and STATICFILES_FINDERS. Make sure you keep the components required by the features of Django you wish to use. Core Settings Here’s a list of settings available in Django core and their default values. Settings provided by contrib apps are listed below, followed by a

setup()

setup(set_prefix=True) [source] Configures Django by: Loading the settings. Setting up logging. If set_prefix is True, setting the URL resolver script prefix to FORCE_SCRIPT_NAME if defined, or / otherwise. Initializing the application registry. Changed in Django 1.10: The ability to set the URL resolver script prefix is new. This function is called automatically: When running an HTTP server via Django’s WSGI support. When invoking a management command. It must be called explicitly in

shortcuts.get_list_or_404()

get_list_or_404(klass, *args, **kwargs) [source] Returns the result of filter() on a given model manager cast to a list, raising Http404 if the resulting list is empty.

shortcuts.get_object_or_404()

get_object_or_404(klass, *args, **kwargs) [source] Calls get() on a given model manager, but it raises Http404 instead of the model’s DoesNotExist exception.

shortcuts.redirect()

redirect(to, permanent=False, *args, **kwargs) [source] Returns an HttpResponseRedirect to the appropriate URL for the arguments passed. The arguments could be: A model: the model’s get_absolute_url() function will be called. A view name, possibly with arguments: reverse() will be used to reverse-resolve the name. An absolute or relative URL, which will be used as-is for the redirect location. By default issues a temporary redirect; pass permanent=True to issue a permanent redirect.

shortcuts.render()

render(request, template_name, context=None, content_type=None, status=None, using=None) [source] Combines a given template with a given context dictionary and returns an HttpResponse object with that rendered text. Django does not provide a shortcut function which returns a TemplateResponse because the constructor of TemplateResponse offers the same level of convenience as render().