Django调试页面布局坏了 [英] Django debug page layout is broken
本文介绍了Django调试页面布局坏了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚推出了我的Django服务器,试图通过浏览器进行访问,但布局破裂,如何解决这个问题?
解决方案
感谢所有的快速回复,我只是用以下方法解决了这个问题: p>
环境:Apache和WSGI
- 将以下行添加到
/ etc / apache2 / sites-enabled / 000-default
<$ p $别名/ static / /path/to/mysite.com/static/
< Directory /path/to/mysite.com/static>
要求全部授予
< / Directory>
- 添加以下行到
settings.py
STATIC_ROOT = BASE_DIR +'/ static'
STATIC_URL ='/ static /'
- 运行
python manage.py collectstatic
并重新启动Apache -
I just launched my Django server, and trying to access it through browser, but the layout is broken, how to fix this issue?
解决方案
Thanks all for your quick response, I just fixed this issue with following method:
Environment: Apache and WSGI
- Add following line to
/etc/apache2/sites-enabled/000-default
Alias /static/ /path/to/mysite.com/static/ <Directory /path/to/mysite.com/static> Require all granted </Directory>
- Add following line to
settings.py
STATIC_ROOT = BASE_DIR + '/static' STATIC_URL = '/static/'
- Run
python manage.py collectstatic
and restart Apache
这篇关于Django调试页面布局坏了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文