Merge remote-tracking branch 'origin/master'

This commit is contained in:
makram89 2022-01-30 15:30:46 +01:00
commit 5ab91ec250
9 changed files with 103 additions and 17 deletions

View File

@ -0,0 +1,64 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream django {
server localhost:8080;
}
server {
if ($host = randomsec.projektstudencki.pl) {
return 301 https://$host$request_uri;
}
listen 80 reuseport;
server_name randomsec.projektstudencki.pl
charset utf-8;
return 404;
}
# configuration of the server
server {
# the port your site will be served on
listen 443 ssl http2 reuseport;
# the domain name it will serve for
server_name randomsec.projektstudencki.pl
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# location /static {
# alias /path/to/static; #TODO add path
# expires 30d;
# access_log off;
# add_header Pragma public;
# add_header Cache-Control "public";
# }
error_page 500 502 503 504 404 403 /error.html;
location = /error.html {
add_header Content-Type text/html;
return 200 '<h1>Loading your instance...</h1><meta http-equiv="refresh" content="1; URL=http://randomsec.projektstudencki.pl/" />';
}
location /logout/ {
proxy_pass http://django;
}
# Finally, send all non-media requests to the Django server.
location / {
if ($cookie_sessionid = ""){
proxy_pass http://django; # TODO prolly change that to uwsgi_pass
}
}
ssl_certificate /etc/letsencrypt/live/randomsec.projektstudencki.pl/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/randomsec.projektstudencki.pl/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
# add_header Strict-Transport-Security max-age=31536000;
}

View File

@ -38,11 +38,11 @@ server {
# add_header Cache-Control "public";
# }
error_page 500 502 503 504 404 /error.html;
error_page 500 502 503 504 404 403 /error.html;
location = /error.html {
add_header Content-Type text/html;
return 200 '<meta http-equiv="refresh" content="1; URL=http://randomsec.projektstudencki.pl/" />';
return 200 '<h1>Loading your instance...</h1><meta http-equiv="refresh" content="1; URL=http://randomsec.projektstudencki.pl/" />';
}
location /logout/ {

View File

@ -1,11 +1,14 @@
worker_processes 1;
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
@ -27,8 +30,8 @@ http {
# SSL Settings
##
ssl_protocols TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
# ssl_prefer_server_ciphers on;
##
# Logging Settings
@ -48,7 +51,7 @@ http {
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##

View File

@ -126,7 +126,7 @@ STATICFILES_DIRS = (
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
LOGIN_REDIRECT_URL = 'home'
LOGIN_REDIRECT_URL = 'loader'
LOGOUT_REDIRECT_URL = 'home'
# Default primary key field type

View File

@ -25,9 +25,8 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('', include('django.contrib.auth.urls')),
path('signup/', SignUpView.as_view(), name='signup'),
path('welcome/', TemplateView.as_view(template_name='home.html'),
name='home'),
path('favicon.ico', RedirectView.as_view(
url=staticfiles_storage.url('images/favicon.ico'))),
path('loader/', TemplateView.as_view(template_name='loader.html'), name='loader'),
path('welcome/', TemplateView.as_view(template_name='home.html'), name='home'),
path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('images/favicon.ico'))),
path('', views.home, name='home')
]

View File

@ -1,6 +1,4 @@
from django.contrib.auth import logout
from django.contrib.auth.forms import UserCreationForm
from django.http import JsonResponse
from django.shortcuts import redirect
from django.urls import reverse_lazy
from django.views import generic

Binary file not shown.

View File

@ -2,8 +2,8 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<meta charset="utf-8">
<title>{% block title %}MultiUserOpenRefine{% endblock %}</title>
</head>
@ -25,5 +25,14 @@
</div>
</div>
</main>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"
integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k"
crossorigin="anonymous"></script>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!-- templates/loader.html -->
{% extends 'base.html' %}
{% block title %}Loader{% endblock %}
{% block content %}
<h3 style="text-align: center;">Your instance is getting ready. Please wait... </h3>
<div class="d-flex justify-content-center">
<div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
{% endblock %}