From 1400784e9bf92853a05e0bdc417efe2cc676acf2 Mon Sep 17 00:00:00 2001 From: navanchauhan Date: Sat, 6 Aug 2022 17:23:06 -0400 Subject: [PATCH] fix --- conf/nginx.conf | 36 +++++++++++++++--------------------- conf/systemd.service | 6 +++--- scripts/install | 2 ++ 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 6b738ce..ed7c245 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,28 +1,22 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/; - -### Example PHP configuration (remove it if not used) - index index.php; - - # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file - #client_max_body_size 50M; - - try_files $uri $uri/ index.php; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; - - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - } -### End of PHP configuration part + proxy_set_header Host $http_host; + proxy_pass http://unix:__FINALPATH__/recipes.sock; + proxy_set_header X-Forwarded-Proto $scheme; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/static { + alias __FINALPATH__/staticfiles; +} + +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/media { + alias __FINALPATH__/mediafiles; +} + + diff --git a/conf/systemd.service b/conf/systemd.service index e3bd4c8..09acc61 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,9 +8,9 @@ Restart=always RestartSec=3 User=recipes Group=www-data -WorkingDirectory=__FINAL_PATH__ -EnvironmentFile=__FINAL_PATH__/.env -ExecStart=__FINAL_PATH__/bin/gunicorn --error-logfile /tmp/gunicorn_err.log --log-level debug --capture-output --bind unix:__FINAL_PATH__/recipes.sock recipes.wsgi:application +WorkingDirectory=__FINALPATH__ +EnvironmentFile=__FINALPATH__/.env +ExecStart=__FINALPATH__/bin/gunicorn --error-logfile /tmp/gunicorn_err.log --log-level debug --capture-output --bind unix:__FINALPATH__/recipes.sock recipes.wsgi:application [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/scripts/install b/scripts/install index c45ad81..d01dc89 100755 --- a/scripts/install +++ b/scripts/install @@ -151,6 +151,8 @@ popd pushd "$final_path" ynh_exec_as $app "$final_path/venv/bin/python3" manage.py migrate ynh_psql_connect_as $db_user $db_pwd <<< "ALTER USER $app WITH NOSUPERUSER;" + ynh_exec_as $app "$final_path/venv/bin/python3" manage.py collectstatic --no-input + ynh_exec_as $app "$final_path/venv/bin/python3" manage.py collectstatic_js_reverse popd