Compare commits

..

3 Commits
beta ... master

Author SHA1 Message Date
Martin Quarda
fe6ef0d4a1 daphne 2024-10-21 10:38:48 +02:00
Martin Quarda
80df7de186 hide not yet ready pages 2024-10-18 08:56:16 +02:00
Martin Quarda
c17e14943a production settings 2024-10-18 08:55:24 +02:00
10 changed files with 14 additions and 135 deletions

View File

@ -1,9 +0,0 @@
FROM greyltc/archlinux-aur:yay
WORKDIR /alkator
COPY alkator alkator
COPY alkatorapi alkatorapi
RUN pacman -Syu python python-weasyprint python-dateutil python-django python-requests python-pip --noconfirm
RUN sudo -u ab -D~ bash -c 'yay -Syu --removemake --needed --noprogressbar --noconfirm python-daphne'
RUN pip install django_prometheus --break-system-packages
EXPOSE 8005
CMD ["/usr/bin/daphne", "alkator.asgi:application", "-b", "0.0.0.0", "-p", "8005"]

View File

@ -25,9 +25,9 @@ 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 = ['0.0.0.0', '127.0.0.1', 'api', 'https://alkator.cz', 'https://beta.alkator.cz', 'localhost']
ALLOWED_HOSTS = ['https://alkator.cz', 'https://beta.alkator.cz', 'localhost']
CSRF_TRUSTED_ORIGINS = ['https://alkator.cz', 'https://beta.alkator.cz', 'https://zaloha.alkator.cz']
CSRF_TRUSTED_ORIGINS = ['https://alkator.cz', 'https://beta.alkator.cz']
# Application definition
@ -40,11 +40,9 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'alkatorapi',
'django_prometheus',
]
MIDDLEWARE = [
'django_prometheus.middleware.PrometheusBeforeMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
@ -52,12 +50,8 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware',
]
PROMETHEUS_LATENCY_BUCKETS = (0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0, 25.0, 50.0, 75.0, float("inf"),)
ROOT_URLCONF = 'alkator.urls'
TEMPLATES = [
@ -86,14 +80,15 @@ SESSION_COOKIE_SECURE = True
DATABASES = {
'default': {
'ENGINE': 'django_prometheus.db.backends.sqlite3',
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
COMGATE_MERCHANT = 484757
COMGATE_TEST = True
COMGATE_SECRET = '2c07bfabd1a5e4a312dc49929de60aa2'
COMGATE_MERCHANT = 485044
COMGATE_TEST = False
COMGATE_SECRET = '4c36b7faf40575073b26570066ca2a9f'
ADMINS = [('Martin Quarda', 'martin@quarda.cz')]

View File

@ -15,7 +15,7 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.urls import path
from alkatorapi.views import (
register_user, register_racer,
login, logout,
@ -51,5 +51,4 @@ urlpatterns = [
path('api/cart/select_delivery', select_delivery),
path('api/cart/delivery', delivery),
path('api/forgotten_password', forgotten_password),
path('', include('django_prometheus.urls')),
]

View File

@ -10,7 +10,7 @@ class RacerAdmin(admin.ModelAdmin):
@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
list_display = ("name", "description", "price", "hidden", "quantity")
list_display = ("name", "description", "price", "quantity")
@admin.register(Invoice)

View File

@ -118,10 +118,8 @@ ALKÁTOR TEAM
email: info@alkator.cz
tel: + 420 728 018 088
web: https://alkator.cz""", "info@alkator.cz", [email])
if mail.send():
mail.send()
return HttpResponse('{"success":"Úspěšně poslán kód pro obnovení hesla uživatele '+ user.email + '", "redirect":"/#forgotten_password"}', content_type='application/json')
else:
return HttpResponse('{"reason":"Nepovedlo se odelat email"}', status=400, content_type='application/json')
else:
try:
user = authenticate(request, username=request.POST['email'], password=request.POST['password'])

View File

@ -1,2 +0,0 @@
#!/bin/bash
docker build -t gitea.angoosh.com/meiri/alkator/api:latest .

View File

@ -1,31 +0,0 @@
services:
api:
image: gitea.angoosh.com/meiri/alkator/api:latest
volumes:
- /home/meiri/alkator/db.sqlite3:/alkator/db.sqlite3
ports:
- "8005:8005"
networks:
- alkator
nginx:
image: nginx:1.27.2
ports:
- "8004:80"
volumes:
- /home/meiri/alkator/nginx.conf:/etc/nginx/nginx.conf:ro
- /home/meiri/alkator/:/alkator
labels:
- "traefik.enable=true"
- "traefik.http.routers.alkatorweb.rule=Host(`zaloha.alkator.cz`)"
- "traefik.http.routers.alkatorweb.entrypoints=websecure"
- "traefik.http.routers.alkatorweb.tls.certresolver=letsencrypt"
- "traefik.http.services.alkatorweb.loadbalancer.server.port=80"
networks:
- alkator
- default
networks:
default:
name: gateway
external: true
alkator:

View File

@ -304,7 +304,7 @@ class Main extends Component {
<li class="nav-item">
<a class="nav-link" href="#payment">Platba</a>
</li>
{Object.keys(this.state.login_status).length === 0 &&
{/*Object.keys(this.state.login_status).length === 0 &&
<li class="nav-item">
<a class="nav-link" href="#login">Přihlášení</a>
</li>
@ -338,7 +338,7 @@ class Main extends Component {
<li class="nav-item">
<a class="nav-link" href="#cart">Košík</a>
</li>
}
*/}
</ul>
</div>
</nav>

View File

@ -1,69 +0,0 @@
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 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://api:8005;
}
location /api/upload_files{
client_max_body_size 100M;
proxy_pass http://api:8005;
}
location /admin {
proxy_pass http://api:8005;
}
location /static {
root /alkator;
}
location /photos {
root /alkator;
}
location /favicon.ico {
root /alkator;
}
location / {
try_files $uri $uri/index.html =404;
}
}
}

View File

@ -1,2 +0,0 @@
#!/bin/bash
docker push gitea.angoosh.com/meiri/alkator/api:latest