first base of project-changed apps: Herd-livestock-tag-log-elasticsearch- fix log.json path
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
import os.path
|
||||
import time
|
||||
# from .models import Log
|
||||
from tinydb import TinyDB, Query
|
||||
from django.core import serializers
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
|
||||
|
||||
class SaveLog:
|
||||
@@ -42,7 +46,7 @@ class SaveLog:
|
||||
}
|
||||
if request.user.is_authenticated:
|
||||
db_data.update({'user': serializers.serialize('json', [request.user, ])})
|
||||
db = TinyDB(f'logs/log.json')
|
||||
db = TinyDB(os.path.join(BASE_DIR, "logs/log.json"))
|
||||
db.insert(db_data)
|
||||
return response
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user