Hi all,

I am currently writing an app that generates static files before serving 
them, and I could use some input! Here's a step-by-step example of how the 
app is setup:

 - the url mapping pulls a database entry
 - using the data entry, static files are created from the data (for 
example, a *.jpeg or a *.gltf)
 - the app serves the html template with the generated static files 
embedded (for example, via an <img> tag)

The issue comes with the creation of the unique static files. I can have 
the app create a file in the static folder, send it off, then delete the 
file to ready for the next request -- but the webpage will run into issues 
if multiple requests are made at the same time. If two people request the 
same url at the same time, the app will fail because both requests are 
trying to create/serve/delete an identical file (i.e. entry123.jpeg) at the 
same time. Trying to mess with the filename to avoid this won't work here 
either (i.e. naming entry123.01.jpeg, entry123.02.jpeg, entry123.03.jpeg, 
...).

I can think of two solutions, but they both are things I'd like to avoid:
 1. have the files premade and stored -- I want to avoid this because of 
the massive filesize required for all these files
 2. have the static files generated in a user-specific directory -- I want 
to avoid this because I'd rather not have registered users on my website

Is there another solution to this? I'm still relatively new with Django, so 
there might be something simple I'm missing.

-Jack

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/190637d2-bd9b-499a-a122-1dc7adf2aca5%40googlegroups.com.

Reply via email to