I have a HTTP sever in one program and my basic application in another one. Both of them are loops, so I have no idea how to:
How are these things usually done? I would really appriciate Python solutions because my scripts are written in Python.
Does a user make an http request which queries the app for some data and return a result? Yes
Does the app collect data and store it somewhere? The app and the HTTP Server both use SQLite database. However the DBs may be different.
Before answering, I think we need some more information:
There are a few options depending on how you're actually using them. Sockets is an option or passing information via a file or a database.
[Edit] Based on your reply I think there's a few ways you can do it:
Some more questions:
Depending on how reliant the two parts can be, it might be best to write a new app to check the database of your app for changes (using hooks or polling or whatever) and post relevent information into the http server's own database. This has the advantage of leaving the two parts less closely coupled which is often a good thing.
I've got a webserver (Apache 2) which talks to a Django app using the fastcgi module. Have a look at the section in djangobook on fastcgi. Apache uses sockets (or regular tcp) to talk to the background app (Django).
[Edit 2] Oops - just spotted that your webserver is a python process itself. If it's all python then you could launch each in it's own thread and pass them both Queue objects which allow the two processes to send each other information in either a blocking or non-blocking manner.