diff --git a/alkator/settings.py b/alkator/settings.py index eac5840..192c073 100644 --- a/alkator/settings.py +++ b/alkator/settings.py @@ -25,7 +25,7 @@ SECRET_KEY = 'django-insecure-#q!-odx05#6o&1dek)4shtqdw!)s5oonenb(tcmuwclu^dy4!# # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False -ALLOWED_HOSTS = ['https://alkator.cz', 'https://beta.alkator.cz', 'localhost'] +ALLOWED_HOSTS = ['127.0.0.1', 'https://alkator.cz', 'https://beta.alkator.cz', 'localhost'] CSRF_TRUSTED_ORIGINS = ['https://alkator.cz', 'https://beta.alkator.cz'] @@ -85,7 +85,6 @@ DATABASES = { } } - COMGATE_MERCHANT = 484757 COMGATE_TEST = True COMGATE_SECRET = '2c07bfabd1a5e4a312dc49929de60aa2' diff --git a/alkator/urls.py b/alkator/urls.py index 744b6ed..4f511f6 100644 --- a/alkator/urls.py +++ b/alkator/urls.py @@ -16,7 +16,6 @@ Including another URLconf """ from django.contrib import admin from django.urls import path -from django.conf.urls.static import static from alkatorapi.views import ( register_user, register_racer, login, logout, @@ -52,4 +51,4 @@ urlpatterns = [ path('api/cart/select_delivery', select_delivery), path('api/cart/delivery', delivery), path('api/forgotten_password', forgotten_password), -] + static('/', document_root='frontend/build') +] \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..09695f3 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,13 @@ +services: + api: + build: . + volumes: + - /home/meiri/alkator.dbsqlite3:/alkator/db.sqlite3 + ports: + - "8005:8005" + nginx: + image: nginx + ports: + - "8004:80" + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..95aa098 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,79 @@ +worker_processes 2; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + + sendfile on; + keepalive_timeout 65; + + map $http_referer $httpReferer { + default "$http_referer"; + "" "(direct)"; + } + map $http_user_agent $httpAgent { + default "$http_user_agent"; + "" "Unknown"; + } + log_format json escape=json '{' + '"time_local": "$time_local", ' + '"remote_addr": "$remote_addr", ' + '"request_uri": "$request_uri", ' + '"status": "$status", ' + '"http_referer": "$httpReferer", ' + '"http_user_agent": "$httpAgent", ' + '"server_name": "$server_name", ' + '"request_time": "$request_time" ' + '}'; + + server { + listen 8080; + server_name localhost; + location = /stub_status{ + stub_status; + } + } + + server { + listen 80; + + server_name zaloha.alkator.cz; + + access_log /var/log/nginx/access.log json; + error_log /var/log/nginx/error.log; + root /alkator/frontend/build; + + location /api{ + proxy_read_timeout 300; + proxy_pass http://localhost:8002; + } + location /api/upload_files{ + client_max_body_size 100M; + proxy_pass http://localhost:8002; + } + location /admin { + proxy_pass http://localhost:8002; + } + location /static { + root /alkator; + } + location /photos { + root /alkator; + } + location /favicon.ico { + root /alkator; + } + + location / { + try_files $uri $uri/index.html =404; + } + + } + + include sites-enabled/*; +} \ No newline at end of file