WhisperMaPhone/whispermaphone/urls.py

24 lines
830 B
Python

from django.conf.urls.static import static
from django.urls import path, include
from thoughts import views
from thoughts.feed import MainFeed
from whispermaphone import settings
from haystack.views import SearchView, search_view_factory
from haystack.query import SearchQuerySet
from haystack.forms import SearchForm
urlpatterns = [
path("", views.index, name="index"),
path("about", views.about, name="about"),
path("login", views.login, name="login"),
path("post", views.post, name="post"),
path("feed", MainFeed()),
path("search", search_view_factory(
view_class=SearchView,
form_class=SearchForm,
searchqueryset=SearchQuerySet().order_by("-posted")
), name="thoughts_search")
] + (static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.DEBUG else [])