Added some initial logging for future potential debugging purposes.

This commit is contained in:
Ada Werefox 2024-03-09 17:17:02 -06:00
parent 0af5bf4bb4
commit ce85d00619

View File

@ -5,10 +5,13 @@ from json import loads, dumps
from math import floor
import requests
from .forms import ServerAddressForm
import logging
# Create your views here.
default_address = 'http://localhost:8000/spoiler'
# logging.basicConfig(encoding='utf-8', level=logging.DEBUG)
def index(request):
request_data = None
@ -21,11 +24,15 @@ def index(request):
# server_address = read_address['address']['default']
if 'listen_address' in request.session.keys():
server_address = request.session['listen_address']
print(request.session['listen_address'])
# TODO: consider serializing user sessions for debugging in the future.
logging.info(
f'Session listen address changed to: {server_address}')
else:
request.session['listen_address'] = default_address
print(request.session['listen_address'])
server_address = default_address
logging.info(
f'Session listen address for {request.session} set to: {server_address}')
is_hidden = True
try:
request_data = requests.get(
@ -107,7 +114,6 @@ def set_address(request):
# la.write(dumps(listen_address))
server_address = form.cleaned_data['server_address_form']
request.session['listen_address'] = form.cleaned_data['server_address_form']
print(request.session['listen_address'])
return HttpResponseRedirect('/')
else:
form = ServerAddressForm()