thuralinhtut commited on
Commit
65def29
1 Parent(s): bde9f5a
Files changed (1) hide show
  1. manage.py +23 -0
manage.py CHANGED
@@ -3,10 +3,33 @@
3
  import os
4
  import sys
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  def main():
8
  """Run administrative tasks."""
9
  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'passportapi.settings')
 
 
 
 
 
10
  try:
11
  from django.core.management import execute_from_command_line
12
  except ImportError as exc:
 
3
  import os
4
  import sys
5
 
6
+ import socket
7
+
8
+ def get_ip_address():
9
+ # Create a socket object
10
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
11
+
12
+ try:
13
+ # Connect to a public DNS server (Google DNS)
14
+ sock.connect(('8.8.8.8', 80))
15
+ # Get the local IP address
16
+ ip_address = sock.getsockname()[0]
17
+ finally:
18
+ # Close the socket
19
+ sock.close()
20
+
21
+ return ip_address
22
+
23
+
24
 
25
  def main():
26
  """Run administrative tasks."""
27
  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'passportapi.settings')
28
+
29
+ # Call the function to get the IP address
30
+ ip = get_ip_address()
31
+ print("IP Address:", ip)
32
+
33
  try:
34
  from django.core.management import execute_from_command_line
35
  except ImportError as exc: