On Sunday, March 9, 2014 3:59:02 PM UTC-4:30, rafiee.nima wrote:
>
> On Sunday, March 9, 2014 10:29:37 PM UTC+3:30, Camilo Torres wrote:
>>
>> On Sunday, March 9, 2014 12:11:11 PM UTC-4:30, rafiee.nima wrote:
>>>
>>> I am new to bootstarp and I want to use it in my django project.
>>> I put the needed folder's(css , js , img) in my project static folder 
>>> and config my setting.py to access static directory
>>> I can access bootstrap.css from 
>>> http:///..myprojecet/static/bootstrap.css which means I correctly config 
>>> setting.py
>>> but the problem is that no bootstrap style applied to my temeplates. (I 
>>> also check in  firebug if css and js files been inclueded )
>>>
>>> here is my base.html code that other templates inhierent from it
>>>
>>> {% load static %}
>>> <!DOCTYPE html>
>>> <html>
>>> <head>
>>>     <meta name="viewport" content="width=device-width, 
>>> initial-scale=1.0">
>>>     <!-- Bootstrap -->
>>>  <link href="{% static 'css/bootstrap.min.css'% }" rel="stylesheet" 
>>> media="screen">
>>> <link href="{% static 'css/bootstrap-theme.min.css' %}" rel="stylesheet">
>>>  </head>
>>> <body>
>>> <div class="btn-group dropup">
>>>   <button type="button" class="btn btn-default">Dropup</button>
>>>   <button type="button" class="btn btn-default dropdown-toggle" 
>>> data-toggle="dropdown">
>>>     <span class="caret"></span>
>>>     <span class="sr-only">Toggle Dropdown</span>
>>>   </button>
>>>   <ul class="dropdown-menu">
>>>   </ul>
>>> </div>
>>> {% block body_block %}
>>> {% endblock %}
>>>
>>> <script src="{% static 'js/jquery-2.1.0.js"></script>
>>> <script src="{% static 'js/bootstrap.min.js"></script>
>>> </body>
>>> </html>
>>>
>> Hello,
>>
>> This URL looks bad:  http:///..myprojecet/static/bootstrap.css
>> What is in your settings.py?
>> Should it be: {% static 'bootstrap.min.css'% }?
>>
>
>
> tnx for reply 
> the actual ulr was http://127.0.0.1:8000/static/css/bootstrap.min.csswhich I 
> use to test if I correctly configure static path and url in my 
> setting.py 
> I attached my setting.py  
>
Hello,

Your configuration seems OK to serve static content from withing 
application directories.

Where in the file system are you putting your static file 
(css/bootstrap.min.css)?

Try this:
if you already have an application, use that, else create one like this:

python manage.py startapp testapp

Inside the newly created test app directory, create static/css/ and put 
your file there. Now try to reload your template to see if the template 
loads.

This may make it work for you, but in your case, is not the final solution. 
You may need to actually put these static files that are 'site global' in a 
central location in your filesystem, let's say: /var/www/static/(css|js|etc)

To do that, you need to add a setting to your settings.py:

STATICFILES_DIRS = (
    '/var/www/static/',)

That way you put all of your static site wide files inside subdirectories 
in a common path.

Regards,
Camilo

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37c0d7de-776b-4078-b915-b66235f934a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to