Django Request Information

Source: Internet
Author: User
Tags http request

Original link: Http://devhttp.com/request/django devhttp

Django request variables, these lines assume you is inside a view according to:

def yourview (Request, ...):

This page was based on the Request and Response Objects page in the Django 1 documentation. HttpRequest attributes

Request.path /request/django
Request.method GET
Request.encoding None
Httprequest.meta

A standard Python dictionary containing all available HTTP headers. Available headers depend on the client and server, but here is some examples:

Request. meta[' document_root ']%/var/www/empty request. meta[' gateway_interface ']% cgi/1.1 request. meta[' http_accept ']% */* request. meta[' http_accept_encoding ']% gzip, deflate request. meta[' http_accept_language ']% ZH-CN request. meta[' http_connection ']% keep-alive request. meta[' http_host ']% devhttp.com request. meta[' http_referer ']% http://www.douban.com/group/topic/12690846/request. meta[' http_user_agent ']% mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; trident/4.0; infopath.2;. NET CLR 2.0.50727;. net4.0c;. net4.0e; 360SE) Request.
meta[' Mod_wsgi.application_group ']% www.devhttp.com| Request. meta[' Mod_wsgi.callable_object ']% application request. meta[' mod_wsgi.listener_host ')% request. meta[' mod_wsgi.listener_port ')% request. meta[' Mod_wsgi.process_group ')% request. meta[' mod_wsgi.reload_mechanism ']% 0 request. meta[' mod_wsgi.script_reloading ']% 1 request. meta[' mod_wsgi.version '% (2, 8) request. meta[' PATH ']%/usr/local/bin:/usr/bin:/bin request. meta[' path_info ']%/Request/django request. meta[' path_translated ']%/var/www/vhost/devhttp.com/devhttp/django.wsgi/request/django request. meta[' query_string ')% request. meta[' REMOTE_ADDR ']% 114.247.50.2 request. meta[' Remote_port ']% 14958 request. meta[' Request_method ']% GET REQUEST. meta[' Request_uri ']%/request/django REQUEST. meta[' script_filename ']%/VAR/WWW/VHOST/DEVHTTP.COM/DEVHTTP/DJANGO.WSGI request. meta[' script_name ')% request. meta[' server_addr ']% 178.77.77.209 request. meta[' server_admin ']% [no address given] request. meta[' server_name ']% devhttp.com request. meta[' server_port ')% request. meta[' Server_protocol ']% http/1.1 request. meta[' server_signature ')% request. meta[' server_software ')% Apache request. meta[' wsgi.errors ']% <mod_wsgi. Log object at 0x2b1cf2886ba0> request. meta[' wsgi.file_wrapper ']% <built-in method File_wrapper of Mod_wsgi. Adapter object at 0x2b1cf2605a08> request. meta[' wsgi.input ']% <mod_wsgi. Input object at 0x2b1ce129c0b0> request. meta[' Wsgi.multIprocess ']% True request. meta[' Wsgi.multithread ']% False request. meta[' wsgi.run_once ']% False request. meta[' wsgi.url_scheme ']% HTTP request.
 meta[' wsgi.version '% (1, 0)
Request.user

This Django.contrib.auth.models.User object was only interesting if you have authentication enabled. This site doesn ' t. request.session

The session contains a key, randomly generated and repeated if the user is able to save the session information.

request.session[' random '] = 469607171413
HttpRequest Methods
Request.get_host () Devhttp.com
Request.get_full_path () /request/django
Request.build_absolute_uri () Http://devhttp.com/request/django
Request.is_secure () False
Request.is_ajax () False

{% for a, bin request. meta%}
{{a}}:{{B}}
{% ENDFOR%}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.