manage.py collectstatic is made for that. It will copy every static file in
your project into a single directory. Even those included in django like
the css of django admin.


2016-09-12 16:57 GMT+02:00 Jonathan Cheng <jonathan950...@gmail.com>:

> i use href="{% static '/assets/css/main.css' %}
> and the css worked
> but i want to use the all files in assets
> is there any other way to do it?
>
> ludovic coues於 2016年9月12日星期一 UTC+8上午1時32分42秒寫道:
>>
>> If you look at the html send by django, what is the href value ?
>>
>> 2016-09-11 19:15 GMT+02:00 Jonathan Cheng <jonatha...@gmail.com>:
>>
>>> i fixed usint STATIC_ROOD = '/static/'
>>> it seems to no error
>>> but when i connect to my runserver
>>> the css of  assets just doesn't work
>>>
>>>
>>> Jonathan Cheng於 2016年9月12日星期一 UTC+8上午1時04分22秒寫道:
>>>
>>>> here i explain , because  i just test how main.css work, finally i want
>>>> to use the assets and images .
>>>> and i use the python mange.py collectstatic
>>>> it showed
>>>>
>>>> ImproperlyConfigured: The STATICFILES_DIRS setting should not contain
>>>>> the STATIC_ROOT setting
>>>>>
>>>>
>>>> ludovic coues於 2016年9月12日星期一 UTC+8上午12時53分08秒寫道:
>>>>>
>>>>> I mentionned tree because I have doubt about what "static - assets -
>>>>> css - main.css" means. If your path is really
>>>>> /mysite/static/assets/css/main.css, then you want <link
>>>>> rel="stylesheet" text = 'html/css' href="{% static
>>>>> 'assets/css/main.css' %}" />.
>>>>>
>>>>> At least with a debug configuration, django will search for static
>>>>> file in each apps' static directory for the path you used as arguments
>>>>> for static.
>>>>> With a production configuration, you should use manage.py
>>>>> collectstatic which will grab all static file and copy them in a
>>>>> single directory.
>>>>>
>>>>> 2016-09-11 18:18 GMT+02:00 Jonathan Cheng <jonatha...@gmail.com>:
>>>>> >
>>>>> > https://gist.github.com/cj10243/fb557903441d4a3e95190b854fbaabe1
>>>>> >
>>>>> > ludovic coues於 2016年9月12日星期一 UTC+8上午12時05分12秒寫道:
>>>>> >>
>>>>> >> I have a hard time to read the paths you use. The command tree
>>>>> produce
>>>>> >> a nice tree view of a directory, it might help. You can also use
>>>>> >> service like http://paste2.org/ or https://gist.github.com/ to
>>>>> share
>>>>> >> it
>>>>> >>
>>>>> >> 2016-09-11 17:58 GMT+02:00 Jonathan Cheng <jonatha...@gmail.com>:
>>>>> >> > thx reply,but it just can see the original html with no css,is my
>>>>> path
>>>>> >> > setted correct?
>>>>> >> >
>>>>> >> > ludovic coues於 2016年9月11日星期日 UTC+8下午11時45分24秒寫道:
>>>>> >> >>
>>>>> >> >> Have you tried to add a few newlines to be sure about which line
>>>>> is the
>>>>> >> >> issue ?
>>>>> >> >>
>>>>> >> >> Also, in you email, there is a space between % and } in the load
>>>>> >> >> staticfiles tag
>>>>> >> >>
>>>>> >> >> 2016-09-11 7:29 GMT+02:00 Jonathan Cheng <jonatha...@gmail.com>:
>>>>>
>>>>> >> >> > I use django1.10
>>>>> >> >> >
>>>>> >> >> > i reference the official doc
>>>>> >> >> > https://docs.djangoproject.com/en/1.10/intro/tutorial06/
>>>>> >> >> >
>>>>> >> >> > my project name:mysite
>>>>> >> >> >
>>>>> >> >> > structure:
>>>>> >> >> >
>>>>> >> >> > - mysite-
>>>>> >> >> >
>>>>> >> >> >              - mysite - urls.py
>>>>> >> >> >
>>>>> >> >> >                        -views.py
>>>>> >> >> >
>>>>> >> >> >                         ...
>>>>> >> >> >
>>>>> >> >> >              - templates - index.html
>>>>> >> >> >
>>>>> >> >> >                          - images
>>>>> >> >> >              - static - mysite - assets - css - main.css
>>>>> >> >> >
>>>>> >> >> >                                         - js
>>>>> >> >> >
>>>>> >> >> >                                         ...
>>>>> >> >> > In my index.html
>>>>> >> >> >
>>>>> >> >> > add
>>>>> >> >> >
>>>>> >> >> > `{% load staticfiles % }
>>>>> >> >> >         <link rel="stylesheet" text = 'html/css' href="{%
>>>>> static
>>>>> >> >> > 'mysite/static/main.css' %}" />`
>>>>> >> >> >
>>>>> >> >> > it said i have a Invalid block tag about TemplateSyntaxError
>>>>> >> >> > `<link rel="stylesheet" type = 'text/css' href="{% static
>>>>> >> >> > 'mysite/static/assets/css/main.css' %}" />`
>>>>> >> >> >
>>>>> >> >> > views.py (about static files part)
>>>>> >> >> > ```STATICFILES_DIRS = [
>>>>> >> >> >     os.path.join(BASE_DIR, "static"),
>>>>> >> >> >     '/mysite/static/',
>>>>> >> >> > ]
>>>>> >> >> > STATIC_URL = '/static/'
>>>>> >> >> > STATIC_ROOT='/mysite/static/'```
>>>>> >> >> >
>>>>> >> >> > what's part should i notice?
>>>>> >> >> >
>>>>> >> >> > --
>>>>> >> >> > You received this message because you are subscribed to the
>>>>> Google
>>>>> >> >> > Groups
>>>>> >> >> > "Django users" group.
>>>>> >> >> > To unsubscribe from this group and stop receiving emails from
>>>>> it,
>>>>> >> >> > send
>>>>> >> >> > an
>>>>> >> >> > email to django-users...@googlegroups.com.
>>>>> >> >> > To post to this group, send email to
>>>>> django...@googlegroups.com.
>>>>> >> >> > Visit this group at https://groups.google.com/grou
>>>>> p/django-users.
>>>>> >> >> > To view this discussion on the web visit
>>>>> >> >> >
>>>>> >> >> >
>>>>> >> >> > https://groups.google.com/d/msgid/django-users/ef2ea6eb-d1cb
>>>>> -40e2-abef-1af246e02e98%40googlegroups.com.
>>>>> >> >> > For more options, visit https://groups.google.com/d/optout.
>>>>> >> >>
>>>>> >> >>
>>>>> >> >>
>>>>> >> >> --
>>>>> >> >>
>>>>> >> >> Cordialement, Coues Ludovic
>>>>> >> >> +336 148 743 42
>>>>> >> >
>>>>> >> > --
>>>>> >> > You received this message because you are subscribed to the
>>>>> Google
>>>>> >> > Groups
>>>>> >> > "Django users" group.
>>>>> >> > To unsubscribe from this group and stop receiving emails from it,
>>>>> send
>>>>> >> > an
>>>>> >> > email to django-users...@googlegroups.com.
>>>>> >> > To post to this group, send email to django...@googlegroups.com.
>>>>> >> > Visit this group at https://groups.google.com/group/django-users.
>>>>>
>>>>> >> > To view this discussion on the web visit
>>>>> >> >
>>>>> >> > https://groups.google.com/d/msgid/django-users/a699584c-d57f
>>>>> -4b84-a38b-fe03638caefd%40googlegroups.com.
>>>>> >> >
>>>>> >> > For more options, visit https://groups.google.com/d/optout.
>>>>> >>
>>>>> >>
>>>>> >>
>>>>> >> --
>>>>> >>
>>>>> >> Cordialement, Coues Ludovic
>>>>> >> +336 148 743 42
>>>>> >
>>>>> > --
>>>>> > You received this message because you are subscribed to the Google
>>>>> Groups
>>>>> > "Django users" group.
>>>>> > To unsubscribe from this group and stop receiving emails from it,
>>>>> send an
>>>>> > email to django-users...@googlegroups.com.
>>>>> > To post to this group, send email to django...@googlegroups.com.
>>>>> > Visit this group at https://groups.google.com/group/django-users.
>>>>> > To view this discussion on the web visit
>>>>> > https://groups.google.com/d/msgid/django-users/6e864bf6-c12b
>>>>> -49bc-b906-d2c35a5e884b%40googlegroups.com.
>>>>> >
>>>>> > For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Cordialement, Coues Ludovic
>>>>> +336 148 743 42
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/5e23939a-bd19-45a7-81be-f3c309b2bbb4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/5e23939a-bd19-45a7-81be-f3c309b2bbb4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Cordialement, Coues Ludovic
>> +336 148 743 42
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/b8d3b4b9-1ea2-46ee-99bd-87ca8a0ad14a%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b8d3b4b9-1ea2-46ee-99bd-87ca8a0ad14a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTaWPWh_pqq59gYMthTR%3DuQK69LXhQeac%2Bt0EHNMBnk43A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to