change config files

This commit is contained in:
prance 2022-01-28 00:41:41 +01:00
parent 5bb0a56053
commit d55ac7c5d1
4 changed files with 15 additions and 12 deletions

View File

@ -2,9 +2,9 @@ import subprocess
class NGINXConfigurator:
_config_path = "/etc/nginx/conf.d/muor.conf"
_location_preamble_path = "configs/muor_before_location_block.conf"
_location_epilouge_path = "configs/muor_after_location_block.conf"
_config_path = "/etc/nginx/nginx.conf"
_location_preamble_path = "MUOR/configs/muor_before_location_block.conf"
_location_epilouge_path = "MUOR/configs/muor_after_location_block.conf"
@classmethod
def refresh_config(cls, sessions):
@ -14,7 +14,7 @@ class NGINXConfigurator:
config = cls._get_config(sessions)
with open(cls._config_path, 'w') as F:
F.write(config)
completed_process = subprocess.run(["nginx", "-s", "reload"])
completed_process = subprocess.run(["sudo" "nginx", "-s", "reload"])
return completed_process.returncode
@classmethod

View File

@ -1,10 +1,6 @@
if ($cookie_sessionid = ""){
uwsgi_read_timeout 600;
uwsgi_send_timeout 600;
uwsgi_connect_timeout 60;
uwsgi_ignore_client_abort on;
uwsgi_pass django;
proxy_pass django; # TODO prolly change that to uwsgi_pass
}
}

View File

@ -1,8 +1,14 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream django {
server localhost:8080
}
server {
listen 80 reuseport;
server_name randomsec.projektstudencki.pl;
@ -30,4 +36,4 @@ server {
# Finally, send all non-media requests to the Django server.
location / {
location / {

View File

@ -8,7 +8,7 @@ from django.conf import settings
def get_sessions_data():
return tuple((session.profile.volume, session.port, session.sessionid)
return tuple((session.user.volume, session.port, session.sessionid)
for session in Session.objects.all())
@ -26,7 +26,8 @@ def profile_saved(sender, instance, **kwargs):
@receiver(user_logged_in)
def profile_start_up(sender, user, request, **kwargs):
try:
user.session = request.session.session_key
user.session
user.session.sessionid = request.session.session_key
user.session.save()
except Profile.session.RelatedObjectDoesNotExist:
# Create session