Python wagtail model class Site

Python wagtail model class Site

In the previous article we explored different type of wagtail core model .If you haven't gone through that,then please click on this link  wagtail core model In this article we will explore one of the model class that is Site.First of all we have to know what is the use of Site model.

Site model is useful for multi-site installations as it allows an administrator to configure which part of the tree to use   for each hostname that the server responds on.
          This configuration is used by the Sitemiddleware middleware class which checks each request against this configuration and appends the Site object to the Django request object.

Now we learn about different type of Datebase fields and Method and properties of 

                               Database fields

     1)hostname  (text)

     This is the hostname of the site, excluding the scheme, port and path.

           For example:

   2)port (number)
      This is the port number that the site responds on.

   3) site_name
A human-readable name for the site. This is not used by Wagtail itself, but is suitable for use on the site front-end, such as in <title> elements.
   For example:  Rod's World of Birds
This is a link to the root page of the site. This page will be what appears at the / URL on the site and would usually be a homepage.
5)is_default_site (boolean)
This is set to True if the site is the default. Only one site can be the default.
The default site is used as a fallback in situations where a site with the required hostname/port couldnot be found.
                  Methods and properties  
1) staticfind_for_request()
     Find the site object responsible for responding to this HTTP request object.
2 )root_url
This returns the URL of the site. It is calculated from the hostname and the port fields.
Return a list of (root_path, root_url) tuples, most specific path first - used to translate url_paths into actual URLs with hostnames


Name Views Likes
C++ Exception Handling-|| 85 3
C++ Exception Handling 116 3
C++ File Handling EOF 93 5
C++ File Handling Error Handling During file Operation 1135 5
C++ File Handling seekp() Function 105 5
C++ File Handling seekg() Function 105 6
C++ File Handling tellg() Function 127 5
C++ File Handling tellp() Function 133 5
C++ File Handling close() Function 78 5
C++ File Handling:: open() 106 5
C++ File Handling Introduction 131 5
C++ Container Library:: std ::array-II 101 4
Top Django Interview Questions and Answers You Need to Know 302 6
C++ Container Library::std::array 96 6
C++ Container Library Introduction 103 5
Essential Engineering Skills for Your Resume 127 5
Mistakes To Avoid During Technical Interview 133 5
Mistakes You Must Avoid During Work From Home 178 6
Seven Common Mistakes that Beginners Should Avoid While Learning to Code 109 6
Simple Linear Regression 96 6
Python wagtailmenus 122 6
Python wagtail application 119 6
Python guppy GSL 136 5
Python wagtail guppy subpackage heapy 174 6
Python guppy Introduction 215 6
Python wagtail Structural Block 258 6
Python wagtail Integrating into Django Project 370 6
Python wagtail testing 280 7
Python wagtail Basic Block 349 7
Python wagtail image tag 216 7
Python wagtail Templates 179 6
Python wagtail Backends 206 6
Python wagtail Indexing 190 6
Python wagtail Search 173 7
Python wagtail Snippets 192 6
Python wagtail Writing your own page models 165 9
Python wagtail model class PageRevision 196 10
Python wagtail model class Site 199 9
Python wagtail wagtail core model 219 9
Python wagtail page models 189 10
Python wagtail 166 11