The joined is located outside of the base path component

Viewed 379

Good Morning Everyone, I developed an app in Django (latest version). On local server it is working well. But for deployment when I run command for collect static then the error occurred

The joined path (C:\Users\Galaxy\PycharmProjects\plugins\js_composer\assets\images\icons\address-book.png) is located
 outside of the base path component (C:\Users\Galaxy\PycharmProjects\medical_store\staticfiles).

I'm using HTML and Bootstrap for front-end but this path error occurred. It's my terminal showing

  return safe_join(self.location, name)
  File "C:\Users\Galaxy\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\_os.py", line 29, in safe_join
    raise SuspiciousFileOperation(
django.core.exceptions.SuspiciousFileOperation: The joined path (C:\Users\Galaxy\PycharmProjects\plugins\js_composer\assets\images\icons\address-book.png) is located
 outside of the base path component (C:\Users\Galaxy\PycharmProjects\medical_store\staticfiles)

I tried to replace the url that was first looking as

{background-image:url(../../../plugins/js_composer/assets/images/icons/address-book.png)}

then I replace it by

{background-image:url(../../../medical_store/static/img/address-book.png)}

But same error found. I don't know how to remove this error. Have you any idea what I have to do exactly?

Here is my settings for staticfiles.

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static')
]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
0 Answers
Related