zoukankan      html  css  js  c++  java
  • gunicorn+Django加载静态文件

    问题描述

    依照官方文档添加静态文件, 执行命令python managy.py runserver时运行正常, 执行命令gunicorn -k gevent mysite.wsgi时加载静态文件报错404.

    解决方案

    修改mysite/wsgi.py

    ...
    from django.contrib.staticfiles.handlers import StaticFilesHandler # 添加模块
    # 修改 application = get_wsgi_application()
    application = StaticFilesHandler(get_wsgi_application())
    

    Nail it! Nice and neat.

  • 相关阅读:
    NSString拼接字符串
    2020/4/26
    2020/4/25
    2020/4/24
    2020/4/22
    2020/4/22
    2020/4/20
    2020/4/19
    2020/4/18
    2020/4/17
  • 原文地址:https://www.cnblogs.com/goldenretriever/p/15627056.html
Copyright © 2011-2022 走看看