In my django/python code I have the following lines:
f = open(os.path.join(DIRECTORY, filname), 'w')
f.write(filecontent)
f.close()
when I have DIRECTORY='/tmp/' it all works fine, the file.txt is saved with owner=root and group=www-data. However, when I want to save the file in a subdirectory of my django-project, for example DIRECTORY='/project/subfolder' the file doesn't appear, although I have that subfolder set to the same owner/group.
I suspect that it is a permission problem with nginx or gunicorn. Any suggestions?
I tried to solve my problem by just mounting the /tmp/ directory to the docker container where I use the file afterwards. But I ran into the problem, that files in the /tmp/ directory do not appear in docker, while as when I mount another folder like /project/subfolder/, these files do appear in docker. So either way, half works, but never both.