neilH
neilH

Reputation: 3438

Python web app ideas- incremental/unique file suggestions for multiple users

Firstly, this question isn't a request for code suggestions- it's more of a question about a general approach others would take for a given problem. I've been given the task of writing a web application in python to allow users to check the content of media files held on a shared server. There will also likely be a postgres database from which records for each file will be gathered.

I want the web app to:

1) Suggest the next file to check (from files that have yet to be checked) and have a link to the next unchecked file once the result of the previous check have been submitted.

2) Prevent the app from suggesting the same file to multiple users simultaneously.

If it was just one user checking the files it would be easier, but I'm having trouble conceptualising how i'm going to achieve the two points above with multiple simultaneous users.
As I say, this isn't a code request i'm just just interested in what approach/tools others feel would be best suited to this type of project. If there are any python libraries that could be useful i'd be interested to hear any recommendations.

Thanks

Upvotes: 0

Views: 57

Answers (1)

jsbueno
jsbueno

Reputation: 110516

These requirements are more or less straightforward to follow. Given that you will have a persistent database that can share the state of each file with multiple sessions - and even multiple deploys - of your system - and that is more or less a given with Python + PostgreSQL.

I'd suggest you to create a Python class with a few fields yuu can use for the whole process, and use an ORM like SQLAlchemy or Django's to bind those to a database. The fields you will need are more or less: filename, filpath, timestamp, check_status - and some extra like "locked_for_checking", and "checker" (which might be a foreignkey to a Users collection). On presenting a file as a sugestion for a given user, you set the "locked_for_checking" flag - and for the overall listing, yu create a list that excçuds files "checked" or "locked_for_checking". (and sort the files by timestamp/size or other metadata that attends your requirements).

You will need some logic to "unlock for checking" if the first user does not complete the checking in a given time frame, but that is it.

Upvotes: 1

Related Questions