Display RTF in browser as Wordpad would do - python

I am trying to read in a complex RTF file and render it in my browser, as WordPad would do.
Is that possible? I have build a simple Flask Web application so far.

Related

CS6 & Python scripting

I have written a couple of scripts and now I would like to make a web based front end to run those scripts so that its more user friendly where users can upload files and then click a few buttons to choose what they want in order to generate the configurations. As of now it works by the script using a path to the file. My question is , can i design the HTML using CS6 and then link python scripts to it, Or I have to learn and code in HTML using flask and Jinja2 templating for this to work. I am obviously not a website designer or have any experience in css,java or html

How can I run my Python Script in Siteground Hosting Server

I am building my website which contains a python(.py) file, html, css and JS file. I want to know that how can I run my python script in siteground from my hosting account so that it can scrape data from a site and output a JSON file to Javascript file which can display it on the webpage.
I would use cron jobs to run jobs in the foreground

Display jinja2 on a web page

I am working on an assignment and just can't resolve the following issue. I have created a python file with jinja2 and the help of an html template. When running the .py file terminal, the output is picobello fine with all the html commands, however I cannot display the file in a web browser. Firefox asks me how to open the python file, whereas chrome only displays the root python code and not the output. How can I display the output? I also need to embed this output to my main html webpage.
Thanks for any help!

Getting Django to run a main.py file

I've written a scientific program in python which outputs a .png and a .pdf
I would like to execute this main.py file from a web interface, with a nice big button saying GO and then display the .png and download a .pdf
I'm using a Django framework to serve the page saying GO. How do i get it to:
run my main.py file?
return the .png file to html template?
download the file which is generated by the main.py script?
Thank you internet
This question is a little broad for a specific answer, but in general, one can:
Have the button access an API which will, on the server, in another thread, your main.py file.
Once the application is finished, move the generated files to a deterministic location that serves static files on your web server.
Provide the user a URL to the newly created file's location.
Have a cron job run to clear out old files in the static directory.

Python sample on Bluemix displays source code instead of HTML output - why?

I am trying out Python on Bluemix. To do this I decided to move an example from a book that worked fine on my Windows laptop. I created the Bluemix example app, then replaced the index.html with the html file from the sample and built my directory tree beneath the static directory. The server starts up fine and displays the intro html file as expected, but when I click on a link that should build my html page it displays the page as source code instead of executing it. On Windows this works perfectly. My call to the page looks like this:
My data.
I have heard that on Linux environments you sometimes need to point out the python executable, but what is the right location of that in a Bluemix environment? Another question would be if the .py file is set to executable, but I don't know how you set such a thing in Bluemix.
All help is appreciated.
You can't directly link to a Python file in a Python webapp. You should use something like Flask to serve your application. Flask can do routing for you.
Additionally, in Bluemix and other Platform as a Services' there is only a single binary entry point to your app. You can't have multiple binary entry points.
See this example app on how to deploy a Flask app.
Additionally, you can click the button below to directly deploy the example app to Bluemix.

Categories