django vue-admin-template-master TemplateDoesNotExist net::ERR_ABORTED 404 (Not Found)报错

1、django.template.exceptions.TemplateDoesNotExist

django views后台程序render到某html文件报错,提示该html不存在,但用的绝对路径,虽然该html不与django程序同一个目录。

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates',BASE_DIR, 'C:/vue-admin-template-master/dist'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

解决办法:setting.py中在该DIRS中添加进html文件所在的路径。

2、GET chunk-libs.3dfb7769.css net::ERR_ABORTED 404 (Not Found)

找到html文件后又提示css,js等配置文件找不到

解决办法:setting.py中将配置文件路径添加进STATICFILES_DIRS中

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'login_register\\static'),
    os.path.join(BASE_DIR, 'C:/vue-admin-template-master/dist/static'),
)

3、POST http:// 403 (Forbidden) send 报错,get请求可访问,POST则访问失败

解决办法:注释setting.py中的django.middleware.csrf.CsrfViewMiddleware

https://blog.csdn.net/xiaobei4929/article/details/25334801

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值