Problems linking to static files in Django 1.3

前端 未结 2 896
别那么骄傲
别那么骄傲 2021-02-09 13:39

I\'m running django 1.3, python 2.7 on windows XP

I\'m trying to setup a css in a static folder for my django app.

The template looks like:



        
相关标签:
2条回答
  • 2021-02-09 14:18

    I bet you have your app running at http://localhost:8000, not http://localhost :)

    Change

    STATIC_URL = 'http://localhost/static/'
    

    to

    STATIC_URL = '/static/'
    

    No need for absolute URL there.

    0 讨论(0)
  • 2021-02-09 14:35

    I created a folder:

    C:\root\workspace\mysite\src\mysite\common
    

    And in my settings, I have:

    STATIC_ROOT = 'C:/root/workspace/mysite/src/mysite/static/'
    STATIC_URL = '/static/'
    STATICFILES_DIRS = (
        "C:/root/workspace/mysite/src/mysite/common/static",
    )
    

    This seems to work.

    0 讨论(0)
提交回复
热议问题