sitemaps.Sitemap

class Sitemap [source] A Sitemap class can define the following methods/attributes: items [source] Required. A method that returns a list of objects. The framework doesn’t care what type of objects they are; all that matters is that these objects get passed to the location(), lastmod(), changefreq() and priority() methods. location [source] Optional. Either a method or attribute. If it’s a method, it should return the absolute path for a given object as returned by items(). If it’s

sitemaps.ping_google()

ping_google() [source] ping_google() takes an optional argument, sitemap_url, which should be the absolute path to your site’s sitemap (e.g., '/sitemap.xml'). If this argument isn’t provided, ping_google() will attempt to figure out your sitemap by performing a reverse looking in your URLconf. ping_google() raises the exception django.contrib.sitemaps.SitemapNotFound if it cannot determine your sitemap URL. Register with Google first! The ping_google() command only works if you have registe

sitemaps.GenericSitemap

class GenericSitemap [source] The django.contrib.sitemaps.GenericSitemap class allows you to create a sitemap by passing it a dictionary which has to contain at least a queryset entry. This queryset will be used to generate the items of the sitemap. It may also have a date_field entry that specifies a date field for objects retrieved from the queryset. This will be used for the lastmod attribute in the generated sitemap. You may also pass priority and changefreq keyword arguments to the Gene

shortcuts.render_to_response()

render_to_response(template_name, context=None, content_type=None, status=None, using=None) [source] This function preceded the introduction of render() and works similarly except that it doesn’t make the request available in the response. It’s not recommended and is likely to be deprecated in the future.

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().

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.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.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.

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

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