From 88b70b0c085600717935b8403f121ee70cfd21a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=BChler=20Ma=C3=ABlys?= Date: Tue, 9 Apr 2024 17:56:54 +0200 Subject: [PATCH] add setting option and command to capistrano --- api/masteriq/settings.py | 1 + config/deploy.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/api/masteriq/settings.py b/api/masteriq/settings.py index 51a3184..21f6af2 100644 --- a/api/masteriq/settings.py +++ b/api/masteriq/settings.py @@ -143,6 +143,7 @@ # https://docs.djangoproject.com/en/5.0/howto/static-files/ STATIC_URL = 'static/' +STATIC_ROOT = 'static/' # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field diff --git a/config/deploy.rb b/config/deploy.rb index 8206beb..2c042fb 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -60,6 +60,19 @@ end end +after 'deploy:updating', 'django:collectstatic' + +namespace :django do + desc 'Install static files' + task :collectstatic do + on roles([:app, :web]) do |h| + within "#{release_path}/api" do + execute :python3, 'manage.py', 'collectstatic' + end + end + end +end + after 'deploy:updating', 'npm:install' namespace :npm do desc 'NPM install'