Looking for general advice on complex program

Michael Hrivnak mhrivnak at hrivnak.org
Sat Jul 16 15:48:17 EDT 2011


Multiple clients reading from and writing to a central collection of
related data is a problem that has been largely solved.  Use a
database, and have the clients act on it with transactions.  There's
no reason to re-invent the wheel.

You could have the clients connect to the database directly over the
network.  Usually not ideal, but still much better than trying to
share XML files.

Or you could write a very simple HTTP-based API, maybe even following
a basic REST pattern.  Heck, a tiny Django app with this REST plugin
might do nearly all the work for you!

http://code.google.com/p/django-rest-interface/

If you aren't a fan of database design, it's ok to keep it simple.
Almost anything you do, even pickling entire XML nodes and sticking
them in a text field in the database, would be better than trying to
share XML files and deal with file locking over the network.

This approach is also likely to involve MUCH less network traffic and
consume far less resources on the clients.

Michael

On Sat, Jul 16, 2011 at 2:14 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Sun, Jul 17, 2011 at 3:41 AM, Josh English
> <Joshua.R.English at gmail.com> wrote:
>> Chris,
>>
>> Thank you for spelling this out. I thought about this as a solution but I don't have the skills to create this server application, and I don't know if the target network can handle this request. They can see files on a shared drive. They can't see each other's computers on the network, and I don't know if I can make a socket work.
>>
>> I do know they put an internal wiki in the system, and if I could figure out how to do these requests over HTTP, I may try that, but that seems to be the wrong solution.
>
> If you can do HTTP, then that presumably means you can do TCP/IP. You
> can run this daemon on a high port to avoid having to run it as root
> (only an issue on Unix), and all you need to know is the IP address or
> host name of the computer that's running it.
>
> Or alternatively, you can actually do this via HTTP - if you already
> have a web server running and it'd be easier to do it that way. I'm
> more inclined to having it separate, but it might be simpler to write
> it as a PHP script (or whatever your web server uses). Just have it
> accept POST requests to update files; but in this case, be *very* sure
> that your security is in place - the last thing you want is a way for
> people out on the internet to edit your files. Check IP addresses and
> such, as well as a username/password check.
>
> Chris Angelico
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list