What are the problems with loading CSS and JS from Django to IIS7?

↘锁芯ラ 提交于 2019-12-01 23:10:57

Right click on your website in IIS7 manager and

  1. add a virtual directory
  2. name it with the same name of your folder you want IIS to handle. lets say static
  3. add the path to your real static folder in your application mine was in myproject/static then ok

and here you go :)

If you are using django >= 1.3 and following the doc you are probably using the 'staticfiles' app.

  1. First, you must configure your II7 to serve static files from the chosen path, by default URL: /static/ and PATH /staticfiles/ (I have no experience with II7 but the conf should be straightforward)
  2. Then run ./manage.py collectstatic to move the static files into the correct path

and you should be done...

More info on production settings here.

Paul

You also need to insert a web.config file into the static directory for IIS to serve the files.

See: Django Static Files - 404

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