I read in some posts and documentations that you can change to relative paths in python with os.path.expanduser(~/.PATHNAME). I struggle with using it at the moment. When I use it, I end up one directory above the destined path.
from django.shortcuts import render
import os
import subprocess
def index(request):
os.path.expanduser('~/.usernames')
files = []
for file in os.listdir("."):
files.append(file)
return render(request, 'sslcert/index.html', dict(files = files))