Python Forum
Help with new Django Project
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with new Django Project
#2
OK I got it to where it's spitting out the information from GitHub Markdown and showing it to me.

Now I'm onto the next step which is the search engine. I'm not sure where I would type my if statements. Do I do this in the view? Or in the manage.py? I'm a little confused as how to go about it can someone try to get me started?

here's what I have :

view.py:

from django.shortcuts import render

from . import util


def index(request):
    return render(request, "encyclopedia/index.html", {
        "entries": util.list_entries()
    })

def wiki(request, title):
    return render(request, "encyclopedia/wiki.html", {
        "entries": util.get_entry(title)
    })

def search(request, search):
    return render(request, "encyclopedia/index.html", {
        "entries": util.get_entry(search)
    })
urls.py:

from django.urls import path

from . import views


urlpatterns = [
    path("", views.index, name="index"),
    path("wiki/<str:title>", views.wiki, name="wiki"),
]
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wiki.settings')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)

if __name__ == '__main__':
    main()
    
Thanks!
Reply


Messages In This Thread
Help with new Django Project - by card51shor - Jul-02-2020, 09:31 PM
RE: Help with new Django Project - by card51shor - Jul-03-2020, 04:36 AM
RE: Help with new Django Project - by ndc85430 - Jul-03-2020, 05:00 AM
RE: Help with new Django Project - by card51shor - Jul-03-2020, 05:09 AM
RE: Help with new Django Project - by ndc85430 - Jul-03-2020, 05:36 AM
RE: Help with new Django Project - by card51shor - Jul-03-2020, 05:40 AM
RE: Help with new Django Project - by ndc85430 - Jul-03-2020, 05:48 AM
RE: Help with new Django Project - by card51shor - Jul-03-2020, 05:52 AM
RE: Help with new Django Project - by ndc85430 - Jul-03-2020, 06:27 AM
RE: Help with new Django Project - by card51shor - Jul-03-2020, 07:04 AM
RE: Help with new Django Project - by ndc85430 - Jul-04-2020, 07:26 AM
RE: Help with new Django Project - by card51shor - Jul-03-2020, 06:15 PM
RE: Help with new Django Project - by card51shor - Jul-04-2020, 07:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Hello I’m trying to run a Django python project on docker but when I try to build the Nessa404 1 1,755 Apr-22-2022, 12:25 PM
Last Post: VadimCr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020