OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Setup API response Logs to EC2 Django development Server with Gunicorn

  • Thread starter Thread starter Momin Ali
  • Start date Start date
M

Momin Ali

Guest
I am new to EC2 and web development. Currently I have a Amazone Linux EC2 instance running, and have installed Django. I am creating a project. I already setup ngnix gunicorn configruation and run the project. But i don't want response like local API response logs.

I run this command tail -f /var/log/gunicorn/mdm_access.log and this is response

Code:
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"

But I Want response like this

Code:
`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.`

Code:
`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.`

type here

Code:
<p>I am new to EC2 and web development. Currently I have a Amazone Linux EC2 instance running, and have installed Django. I am creating a project. I already setup ngnix gunicorn configruation and run the project. But i don't want response like local API response logs.</p>
<p>I run this command <code>tail -f /var/log/gunicorn/mdm_access.log</code> and this is response</p>
<pre><code>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"
</code></pre>
<p>But I Want response like this</p>
<pre><code>`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.`
</code></pre>
<pre><code>`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.`
</code></pre>
<p>type here</p>
<pre><code>
</code></pre>
Continue reading...
 

Latest posts

P
Replies
0
Views
1
Paul Gilmartin
P

Online statistics

Members online
0
Guests online
2
Total visitors
2
Ads by Eonads
Top