Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fe6ef0d4a1 | ||
|
80df7de186 | ||
|
c17e14943a |
@ -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"]
|
@ -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')]
|
||||
|
@ -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')),
|
||||
]
|
||||
]
|
||||
|
@ -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)
|
||||
|
@ -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():
|
||||
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')
|
||||
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:
|
||||
try:
|
||||
user = authenticate(request, username=request.POST['email'], password=request.POST['password'])
|
||||
|
2
build.sh
2
build.sh
@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
docker build -t gitea.angoosh.com/meiri/alkator/api:latest .
|
@ -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:
|
@ -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>
|
||||
|
69
nginx.conf
69
nginx.conf
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user