mirror of
https://github.com/godotengine/godot-showreel-voting.git
synced 2026-01-05 22:09:47 +03:00
Allow Django to serve static files directly
This commit is contained in:
@@ -36,8 +36,8 @@ services:
|
||||
depends_on:
|
||||
- database
|
||||
- keycloak
|
||||
volumes:
|
||||
- statics:/var/www/showreel.godotengine.org/static/
|
||||
#volumes:
|
||||
#- statics:/var/www/showreel.godotengine.org/static/
|
||||
secrets:
|
||||
- gdshowreel_django_db_password
|
||||
- gdshowreel_django_secret
|
||||
@@ -47,7 +47,7 @@ services:
|
||||
nginx:
|
||||
build: nginx
|
||||
volumes:
|
||||
- statics:/var/www/showreel.godotengine.org/static/
|
||||
#- statics:/var/www/showreel.godotengine.org/static/
|
||||
- ./certificates:/etc/nginx/ssl/ # WARNING: in production, change to real certificates storage dir
|
||||
ports:
|
||||
- "80:80"
|
||||
@@ -67,5 +67,6 @@ secrets:
|
||||
gdshowreel_oidc_rp_client_secret:
|
||||
file: ./secrets/gdshowreel_oidc_rp_client_secret.txt
|
||||
|
||||
volumes:
|
||||
statics:
|
||||
# The following lines and the corresponding volumes mounts can be uncommented for allowing the nginx server to serve the static files (if the Django app doesn't do it)
|
||||
#volumes:
|
||||
# statics:
|
||||
|
||||
@@ -129,6 +129,7 @@ USE_TZ = True
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
||||
|
||||
SERVE_STATICS = True
|
||||
STATIC_ROOT = os.environ.get('DJANGO_STATIC_ROOT', "/var/www/showreel.godotengine.org/static/")
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
|
||||
@@ -13,9 +13,12 @@ Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
from django.urls import path, include
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import views
|
||||
from django.conf import settings
|
||||
|
||||
urlpatterns = [
|
||||
# Login
|
||||
@@ -27,4 +30,8 @@ urlpatterns = [
|
||||
|
||||
# Vote
|
||||
path('', include('vote.urls')),
|
||||
]
|
||||
]
|
||||
|
||||
# Serve static files
|
||||
if settings.SERVE_STATICS:
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
@@ -32,8 +32,9 @@ http {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
root /var/www/showreel.godotengine.org/;
|
||||
}
|
||||
# Statics are served by the django app, but could be served by nginx too.
|
||||
#location /static/ {
|
||||
# root /var/www/showreel.godotengine.org/;
|
||||
#}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user