A Django app to conduct generic search on a django web application.
Project description
Django Generic Search is a Django app to conduct generic search on your site’s pages. Visitors on your site can search for any available pages on your side given they new or can guess accurately keywords or search queries related to thos pages.
The app uses the page title and meta name and meta description html tags to generate search results so be sure to include this tags in your html page templates.
The application is currently not optimized for sites that result in large amounts of data upon crawling.
For a better experience, this app can be used together with django-robots and the django sitemaps framework.
Quick start
Install the package using pip.
$ pip install django-generic-search
Add generic-search to your INSTALLED_APPS setting like this
INSTALLED_APPS = [
...
'generic-search',
]
Include the generic-search URLconf in your project urls.py like this
path('search/', include('generic-search.urls')),
Create a html form and point its action attribute to the above url as below
<form method="GET" action="{% url 'search:general_search' %}">
<input type="text" name="q" placeholder="Search...">
<button type="submit" class="btn btn-outline-primary custom-inline-button">Go</button>
</form>
include settings below in project settings.py
ALLOWED_HOSTS = [
'localhost',
]
SPYDER_START_URLS = {
'gammaspider': ['https://localhost:8000/']
}
When in production, update the settings above appropriately to reflect your production environment.
Override the default template used to display the search index and search results page to reflect the theme of your site by creating a templates directory in your project root directory. In the created templates directory, create a directory with the name generic_search and place index.html in it. You can copy the template provided in the package to the path created above to get a full picture of the available blocks that can be overriden.
Run python manage.py crawlsite to create an index of the available pages on your site.
Start the development server and visit http://127.0.0.1:8000/
Visit http://127.0.0.1:8000/search/?q=<search-query> to retrieve search results.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-generic-search-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ea26d44bb9ab0258ae86da98da297c88b8a24a39a32ae2805bcd563100426f6 |
|
MD5 | 76770c715b257925c485003bdda00ffa |
|
BLAKE2b-256 | e4cf96ba682d367117fd42ac75a24076c2286370333e6763790b0c952fa0e1a8 |
Hashes for django_generic_search-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1516b5a852778573189c84744c095ae149e6797a1bfcac2be13085c81ec9f94e |
|
MD5 | e280ad0daffc334cf0b0b59d4599f54b |
|
BLAKE2b-256 | 618a01559d1a6dece1e722d8a1d6943d4741933502c4a0eb5adcd2ab50376f64 |