Serving static files for development mode in Django

断了今生、忘了曾经 提交于 2019-12-04 13:23:24

It doesn't work, because what I was trying to do wasn't very wise.

That's how it should be configured. settings.py:

MEDIA_URL = '/media/'
STATIC_URL = '/static/'

MEDIA_ROOT = 'media.mydomain.com'
STATIC_ROOT = 'static.mydomain.com'

STATIC_DIRS = (
    os.path.join(os.path.abspath(os.path.dirname(__file__) + '/..'), 'static'),
)

All the files remain in place, exactly where they were.

mrmagooey

I had a similar problem, adding an explicit reference to the media location in my urlconf as per this fixed the problem for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!