V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
ljcarsenal
V2EX  ›  Python

django 新加入图片无法访问的问题?

  •  
  •   ljcarsenal · 2015-02-28 18:36:28 +08:00 · 2654 次点击
    这是一个创建于 3338 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在一个django的static文件夹下面 新加入了几张图,但是从浏览器访问 404,但是同目录下的图片文件(之前加入的)可以访问到。已确认文件名没有输入错误,这是怎么回事?
    6 条回复    2015-03-06 17:57:37 +08:00
    ericFork
        1
    ericFork  
       2015-02-28 19:28:08 +08:00
    部署方式是怎样的,是不是没有 collectstatic?
    wph95
        2
    wph95  
       2015-02-28 21:22:50 +08:00
    DEBUG=True试试
    仔细看看django doc 关于 static的部分
    ps.直接看官方的文档吧 讲的通俗易懂
    RIcter
        3
    RIcter  
       2015-02-28 21:48:25 +08:00 via iPad
    权限问题?
    gamexg
        4
    gamexg  
       2015-03-01 11:14:46 +08:00
    同1 楼。
    新版本 开 DEBUG 时开发服务器访问 static 实际上是访问的 /app/static 下面的文件。
    发布后却访问 /static 下面,不是一个文件夹。

    可用 collectstatic 把 app/static 下的内容合并到 /static。
    apelif
        5
    apelif  
       2015-03-01 14:12:49 +08:00
    可能是权限问题
    kidblg
        6
    kidblg  
       2015-03-06 17:57:37 +08:00
    权限问题,ls -l一下
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   981 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:41 · PVG 06:41 · LAX 15:41 · JFK 18:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.