I have a web app that I want to run using Docker container with nginx. As I know, it is suggested that I use read-only container for security purposes, but when I run my app on local machine, it always generates __pycache__
folder. Will it be a problem when running in read-only environment? If yes, how to solve it?
You can start Python with the -B
argument:
python -B myscript.py
This turns off writing .pyc
and .pyo
files when you import .py
files.
Alternatively, you set and environmental variable:
PYTHONDONTWRITEBYTECODE=x