我正在使用django建立网络,每当我移至另一台计算机时,我的静态文件总会出现404错误。
我尝试使用findstatic命令,它说它找到了我的静态文件,但仍然无法在我的网站上加载
python manage.py findstatic css/base.css
Found 'css/base.css' here:
/home/aoki/Project/Menulis/code/static/css/base.css
我也尝试过使用“收集静态”和“ STATIC_ROOT”设置,但这只是行不通的
这是我的设置。py
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
STATICFILES_DIRS = (
os.path.join(BASE_DIR,'static/'),
)
STATIC_URL = 'static/'
LOGIN_REDIRECT_URL= '/'
MEDIA_ROOT = os.path.join(BASE_DIR,'media/')
MEDIA_URL = '/media/'
这是日志
[25/May/2019 03:17:51] "GET / HTTP/1.1" 200 6373
[25/May/2019 03:17:51] "GET /static/js/main.js HTTP/1.1" 404 1037
[25/May/2019 03:17:51] "GET /static/css/base.css HTTP/1.1" 404 1037
[25/May/2019 03:17:51] "GET /static/images/graphics/dev.svg HTTP/1.1" 404 1037
[25/May/2019 03:17:51] "GET /static/css/base.css HTTP/1.1" 404 1037
[25/May/2019 03:17:51] "GET /static/images/graphics/dev.svg HTTP/1.1" 404 1037
[25/May/2019 03:17:51] "GET /static/js/main.js HTTP/1.1" 404 1037
[25/May/2019 03:17:51] "GET /static/js/sw.js HTTP/1.1" 404 1037
谢谢