[Fixed]-Pycharm + Django 1.3 + STATIC_URL in templates = Unresolved static reference

7👍

PyCharm 2.5 finds my static files again.

The trick is to mark app1/static and app2/static as “Source Root”.

STATICFILES_DIRS is not working for me.

👤Blaise

10👍

Go to Settings in Pycharm 2.73

Settings >> Project Setting >> Django

Enable the Django support and provide the paths for the three following files:

Project Root
Settings file
Manage.py file

When you have given these informations, close PyCharm and restart it.

👤A.J.

1👍

The selected answer doesn’t work for me. What solved it is using a prefix in STATICFILES_DIRS:

STATICFILES_DIRS = (
    # ...
    ("resources", "C:/data/django/myproject/myapp/static"), )

as documented in the django docs: https://docs.djangoproject.com/en/1.4/ref/contrib/staticfiles/

Then in your html template:

<link rel="stylesheet" href="{%static 'resources/favicon.png' %}" type="text/css">

0👍

STATICFILES_DIRS works for

{% static "js/lib/jquery-1.8.2.min.js" %}

tag in template.
Not for {{ STATIC_URL }}js/lib/jquery-1.8.2.min.js

http://youtrack.jetbrains.com/issue/PY-5568

Leave a comment