Forums

Cant find log file in always on task when django initializes

I have setup a django app with logging feature. In settings.py file a LOGGING variable is defined as per the standard django practise as describe in docs. the is one key-value pair inside the LOGGING json file 'filename': './logs/debug.log', Here ./ is the root folder of django app having manage.py file. So the absolute path to the log file would look like /home/eyal360/DjangoProjectName/logs/debug.log but when running the an always on task, I am getting the error that FileNotFoundError: [Errno 2] No such file or directory: '/home/eyal360/logs/debug.log'

How do I change this path?

"." in a path is not the root folder of the Django app. It refers to the working directory. See https://help.pythonanywhere.com/pages/NoSuchFileOrDirectory/

Ohh, my bad. I replaced relative with absolute path and everything is working.