im currently studying having a python program supply data to a website. to do this, i am working with a simple example. as a disclaimer to you guys: im quite new with webservers and websites so please bear with me.

1. the python program simply generates a random number continuously every few seconds.
2. this data should then be displayed to website
3. what i therefore need is some sort of "socket" that will stay open and receive the python data

btw, im using apache 2.2 as my webserver

im sure most of you have done something similar to this before so please guide me. ive read some solutions (websockets) but most of them are too complex for my trivial application. thank you

Recommended Answers

All 2 Replies

For me it look like you can only write to a file the information and update from there. Only need to check for method of forcing a element to refresh regularly. This I found by quick Googling:

Reload All By Itself
This one's nice and easy. I'll give you the code. Copy and paste it into the document you wish to reload. Once in there, change the number of seconds you wish the page to wait before starting the reloading process. This code goes in between the HEAD tags.

<META HTTP-EQUIV="refresh" CONTENT="15">

Right now, the command is set to reload every 15 seconds. I checked a couple of online sites and they were all set about the same. I found the sites displaying stock information were set to around five minutes or 300 seconds.

I don't have a refresh on this page because the darn thing would just keep refreshing and there's nothing on this page that will update.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.