how to design a page in django cms
Question: I want to design a page in django that has a search bar in which user enters a
keyword to search it in the 10 xml documents . I have designed the python code
for searching the words using xml parsing. I also have developed an app called
"**search** " in django but that app has to have this page that I want to
design. Right now, my app is taking input from the terminal but I want that
the word should be entered through this web page that I will design. How can I
do that?

This is my code that will sit at back end:

    
    
    #!/usr/bin/python
    
    import sys 
    sys.path.insert(0,'/home/pooja/Desktop/mysite')
    
    #to tell django which settings module to use 
    import os
    os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
    
    from search.models import Keywords 
    
    from skey import find_root_tags, count, sorting_list
    
    str1 = raw_input("enter the word to be searched\n")  # taking input from user on terminal but I want it to be taken through that page
    list = []
    fo = open("xml.txt","r")
    
    for i in range(count.__len__()):
    
        file = fo.readline()
        file = file.rstrip('\n')
        find_root_tags(file,str1,i) 
    
        list.append((file,count[i]))
    
    sorting_list(list)
    
    for name, count in list:
        s = Keywords(file_name=name,frequency_count=count)
        s.save()
    
    fo.close()
    

Here django_project = mysite #my project's name and app = search #my app's
name

Please help.


Answer: create view in search app with form and recive search key and ...

see these pages

  * Django | Working with forms | Django documentation -> <https://docs.djangoproject.com/en/dev/topics/forms/>

  * Django | Writing views | Django documentation ->  
<https://docs.djangoproject.com/en/dev/topics/http/views/>

