python - Display a huge file on GUI -


i new programming world. have started learning python. trying develop program gets user input, runs commands in background , display output on web interface. although little more complex, simplicity, can consider as:

  1. user enters filename
  2. python code runs "cat filename"
  3. output displayed on screen.

i have python + django + apache setup. using html to display output. working fine long output being returned reasonably small. have huge output (~700 mb) , having difficulty displaying on web interface.

code snippet: op = subprocess.check_output(cmd,universal_newlines=true) return render (request, 'display.html', {'op': op}) 

what best approach display such large content on web? points wanted put on table:

  • store output in file rather string. read file in chunks.in case, can have code write file , read file display simultaneously? don't think idea wanted check.
  • are there python packages intended resolve such problem? django feature?
  • when have huge output, takes while program output , takes while displayed on screen.

you can't display 700 mb of alphanumerical data @ once on regular screen , if could, user drown in it. should display portions , enable scrolling or selection. indicate, loading data costs quite time. since don't view in 1 piece, don't have load in 1 piece. rather refreshing whole page should use ajax (as e.g. implemented in jquery) have browser load data appropriate html/dom element in portions indicated user e.g. shifts scrollbar. given fact 700 mb in case much, better way select data display using type of hierarchical (tree) control or non-sequential selection mechanism. task of django in case, apart serving page itself, serving requested data portion, e.g. json data. mentioned page holding both displayed data portion , selection controls served once.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -