Skip to content

Conversation

@MisterBlueBear
Copy link
Contributor

These changes fix the django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path as seen in #622 and #605.

Static files in the static directory are moved to webvirtcloud/static and framework component files (i.e. rest_framework/* and drf-yasg/*) are deleted as they will be copied / linked by collectstatic.
Also, instead of copying static files into the static directory, I think using symbolic links (--link) will be better as it uses less disk space and the --clear removes orphan static files which may no longer be part of a framework component or the WVC static directory.

python3 manage.py collectstatic --noinput --clear --link

Note: When updating WVC, the below code in webvirtcloud/settings.py

if not DEBUG:
    STATIC_ROOT = ""

STATICFILES_DIRS = [
    Path.joinpath(BASE_DIR, "static"),

]

must be replaced with

STATIC_ROOT = "static"

STATICFILES_DIRS = [
    Path.joinpath(BASE_DIR, "webvirtcloud/static"),
]

The webvirtcloud/settings.py.template is up-to-date with the changes so a new installation will work out-of-the-box.

I commented and posted additionnal explanations for these changes at #605 (comment)

@catborise
Copy link
Collaborator

changing static files structure is not appropriate, because there will be to two copy of static files. one of them static/, other one webvirtcloud/webvirtcloud/static.
whitenoise project solves this static problem. i hope it will fix for every scenario. to using whitenoise on development/locale, --nostatic parameter must be added manage.py runserver command

@MisterBlueBear
Copy link
Contributor Author

@catborise I was just following the django 4.2 docs for STATIC_ROOT which says :

This should be an initially empty destination directory for collecting your static files from their permanent locations into one directory for ease of deployment; it is not a place to store your static files permanently. You should do that in directories that will be found by staticfiles’s finders, which by default, are 'static/' app sub-directories and any directories you include in STATICFILES_DIRS).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants