Re: Trouble with CSS/Static Files
Hi,
>$ manage.py collectstatic
Can you explain why I need to do this on my dev machine when I am not deploying it to production ? If I look at the docs at https://docs.djangoproject.com/en/dev/howto/static-files/#deployment , it mentions that I need to run this to deploy it. However, the problem I was getting was on my local system.
Vibhu
--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius
On Fri, Apr 5, 2013 at 4:00 AM, CJ Milholland <cjm1504@gmail.com> wrote:
Have you ran$ manage.py collectstatic
On Thursday, April 4, 2013 12:49:11 AM UTC-7, Vibhu Rishi wrote:I am not sure where I am going wrong, but the CSS files are just not getting picked up. I have just started a project and am using the dev server with the runserver command.Here's my relevant settings.py :STATIC_ROOT = os.path.join(os.path.dirname(__file__),'/static/')STATIC_URL = '/static/'
My directory structure :.├── homepage│ └── templates│ └── homepage├── qj└── static├── css├── img└── jsqj is where my settings.py file is.static is where i have the css. I am using bootstrap css files. I want it to be at the top location as these files are going to be used in all the apps that i will be writing.homepage is where i have the index page that I am trying to link the css to. the html is as follows :
$ cat homepage/templates/homepage/index.html<!DOCTYPE html><html><head>{% load static %}<title>Hello World!</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- Bootstrap --><link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet" media="screen"></head><body><h1>Hello World</h1><script src="http://code.jquery.com/jquery.js"></script><script src="static/js/bootstrap.min.js"></script></body></html>I am trying both the {% static <url> %} and the hardcoded static/js to see if it is working. The following is the output i get on loading the / page:[04/Apr/2013 12:23:38] "GET / HTTP/1.1" 200 413[04/Apr/2013 12:23:38] "GET /static/css/bootstrap.min.css HTTP/1.1" 404 1667[04/Apr/2013 12:23:38] "GET /static/js/bootstrap.min.js HTTP/1.1" 404 1661It just is not picking up the css or the js file. What am I doing wrong ?Regards,Vibhu--
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius
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+unsubscribe@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home