Django: How do I get a magazine to work?

I added the following to the settings.py file:

import logging
...
logging.basicConfig(level=logging.DEBUG,
    format='%(asctime)s %(levelname)s %(message)s',
    filename=os.path.join(rootdir, 'django.log'),
    filemode='a+')

And in views.py I added:

import logging
log = logging.getLogger(__name__)
...
log.info("testing 123!")

Sorry, no log file is created. Any ideas what I'm doing wrong? And also their best method that I should use to register? I am doing this in a webfaction.

+3
source share
1 answer

Python logs for Django work fine somewhere like Webfaction. If you were based on a cloud provider (for example, Amazon EC2), where you had several servers, it might be worth looking at either registering for the DB key-value or using the Python protocol over the network.

settings.py , , rootdir - syslog , , Django 500, " t log .

, ( WebFaction) , :

import logging
logging.info("Something here") 

log.info

+2

Source: https://habr.com/ru/post/1745620/


All Articles