0

上有一个项目Django 1.9。我重写了它1.11。但是当我部署到服务器并收集静态时,我得到一个错误

django.core.exceptions.SuspiciousFileOperation:连接路径(/var/www/vhosts/finbee.freshlimestudio.com/assets/fonts/finbeeFont/fonts/finbeeFont.eot)位于基本路径组件(/var/www/vhosts/finbee.freshlimestudio.com/static)之外

这里的所有追溯:

PROJ_MODULE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
ROOT = os.path.normpath(os.path.join(PROJ_MODULE_ROOT, ".."))
root_path = lambda *args: os.path.join(ROOT, *args)
path = lambda *args: os.path.join(PROJ_MODULE_ROOT, *args)


STATIC_URL = '/static/'
STATIC_ROOT = ''

STATICFILES_DIRS = (
    path('static'),
)

STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'pipeline.finders.PipelineFinder',
)
4

1 回答 1

1

lambda函数是否必要?像这样的东西应该工作。

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__), '..'))

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
于 2019-07-25T14:13:10.410 回答