Настройка журналов ответов API на сервере разработки Django в EC2 с помощью Gunicorn

Я новичок в EC2 и веб-разработке. В настоящее время у меня запущен экземпляр Amazone Linux EC2, и я установил Django. Я создаю проект. Я уже настроил конфигурацию ngnix gunicorn и запустил проект. Но я не хочу получать ответы в виде локальных журналов ответов API.

Я выполняю эту команду tail -f /var/log/gunicorn/mdm_access.log и вот ответ

127.0.0.1 - - [28/Jun/2024:12:55:35 +0000] "GET /auth.html HTTP/1.0" 404 2312 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:12:55:35 +0000] "GET /api/sonicos/auth HTTP/1.0" 404 2333 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:12:55:35 +0000] "GET / HTTP/1.0" 404 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:12:55:35 +0000] "GET /auth1.html HTTP/1.0" 404 2315 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:12:55:35 +0000] "GET /sslvpnLogin.html HTTP/1.0" 404 2333 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:12:55:35 +0000] "GET /api/sonicos/tfa HTTP/1.0" 404 2330 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:12:55:46 +0000] "GET / HTTP/1.0" 404 179 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:12:55:46 +0000] "GET /favicon.ico HTTP/1.0" 404 2318 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:13:00:30 +0000] "GET / HTTP/1.0" 404 179 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
127.0.0.1 - - [28/Jun/2024:13:00:43 +0000] "GET / HTTP/1.0" 404 179 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"

Но я хочу получить такой ответ

`ERROR UserProfile matching query does not exist.
Traceback (most recent call last):
  File "/opt/python/current/app/profiles/views.py", line 514, in get_profile_details
    user_profile_detail = UserProfile.objects.get(mobile1=mobile, account_type=account_type)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/db/models/query.py", line 385, in get
    self.model._meta.object_name
profiles.models.DoesNotExist: UserProfile matching query does not exist.`
`ERROR UserProfile matching query does not exist.
Traceback (most recent call last):
  File "/opt/python/current/app/profiles/views.py", line 514, in get_profile_details
    user_profile_detail = UserProfile.objects.get(mobile1=mobile, account_type=account_type)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/db/models/query.py", line 385, in get
    self.model._meta.object_name
profiles.models.DoesNotExist: UserProfile matching query does not exist.`

напечатайте здесь


Вернуться на верх