[PYTHON] [Django] A memo when log was not

[Python] Summary of Django log output Basically, this method should be fine.

If it doesn't come out for some reason, I will use a custom logger. Reference: How to log with Django

import logging,os

logfile = os.path.dirname(__file__)+"log.txt"
logging.basicConfig(filename=logfile,level=logging.DEBUG)
logging.info("hogehoge")

When I thought that the file could not be created easily, the location specification of the logfile was strange. I was looking for a similar path in the previous article ...

Recommended Posts

[Django] A memo when log was not
A memo when Django was released on VPS (preparation)
[Django memo] Failure when installing modal
Raise an exception or log when a Django template variable is invalid
DJango Memo: From the beginning (creating a view)
A memo when creating a python environment with miniconda
python memo-"if not A and B" was "if (not A) and B"
A memo to create a virtual environment (venv) before Django
What I did when I stumbled on a Django tutorial
A memo about building a Django (Python) application with Docker
To myself as a Django beginner (4) --Create a memo app--
Create a Django schedule
heroku deployment memo (Django)
Django memo # 1 from scratch
Start a Django project
[Memo] Django development environment
[Django] A memorandum when you want to communicate asynchronously [Python3]
[Memo] Build a development environment for Django + Nuxt.js with Docker
A solution when you can't start project Django on Windows
A memo when face is detected with Python + OpenCV quickly
A memo when creating a directed graph using Graphviz in Python
When I tried to scrape using requests in python, I was addicted to SSLError, so a workaround memo