Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango static path is not properly set
    primarykey
    data
    text
    <p>I am trying to learn <code>Django</code>, In settings.py I have set:</p> <pre><code>MEDIA_ROOT = '/home/hussain/django/ratingsite/ratingsite/media' MEDIA_URL = 'media/' STATIC_ROOT = '/home/hussain/django/ratingsite/ratingsite/static' STATIC_URL = '/static/' STATICFILES_DIRS = ( '/home/hussain/django/ratingsite/ratingsite/static',) </code></pre> <p>I have my css files in my </p> <pre><code>/home/hussain/django/ratingsite/ratingsite/static/css/default.css </code></pre> <p>but when I try to access the webpage it doesnot load the css and gives Error.</p> <pre><code>"NetworkError: 500 Internal Server Error - http://localhost:8000/static/css/default.css" </code></pre> <p>I am new to this so I dont understand what is my root directory. what runs first and how Django tries to find the resources. If someone can guide me through this it would be great.</p> <p><hr> Guyz Guyz I was just doing hit and try and this happened. I renamed my <code>static</code> folder to <code>staticfiles</code> and then in <code>STATICFILES_DIRS</code> replaced the path from <br> <code>'/home/hussain/django/ratingsite/ratingsite/static/',</code> to<br> <code>'/home/hussain/django/ratingsite/ratingsite/staticfiles/',</code> and it worked. <br>I have No Idea why. can someone please explain ?</p> <p>output of <code>python manage.py runserver --traceback</code></p> <pre><code>hussain@jarvis:~/django/ratingsite$ python manage.py runserver --traceback Validating models... 0 errors found December 08, 2013 - 01:48:39 Django version 1.5.4, using settings 'ratingsite.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. [08/Dec/2013 01:48:41] "GET / HTTP/1.1" 200 930 Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 73, in __call__ return super(StaticFilesHandler, self).__call__(environ, start_response) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 255, in __call__ response = self.get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 63, in get_response return self.serve(request) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 56, in serve return serve(request, self.file_path(request.path), insecure=True) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/views.py", line 38, in serve absolute_path = finders.find(normalized_path) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 238, in find for finder in get_finders(): File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 253, in get_finders yield get_finder(finder_path) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 31, in wrapper result = func(*args) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 275, in _get_finder return Finder() File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 62, in __init__ "The STATICFILES_DIRS setting should " ImproperlyConfigured: The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting [08/Dec/2013 01:48:42] "GET /static/css/default.css HTTP/1.1" 500 59 Traceback (most recent call last): Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) self.result = application(self.environ, self.start_response) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 73, in __call__ File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 73, in __call__ return super(StaticFilesHandler, self).__call__(environ, start_response) return super(StaticFilesHandler, self).__call__(environ, start_response) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 255, in __call__ File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 255, in __call__ response = self.get_response(request) response = self.get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 63, in get_response File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 63, in get_response return self.serve(request) return self.serve(request) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 56, in serve File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 56, in serve return serve(request, self.file_path(request.path), insecure=True) return serve(request, self.file_path(request.path), insecure=True) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/views.py", line 38, in serve File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/views.py", line 38, in serve absolute_path = finders.find(normalized_path) absolute_path = finders.find(normalized_path) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 238, in find File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 238, in find for finder in get_finders(): for finder in get_finders(): File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 253, in get_finders File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 253, in get_finders yield get_finder(finder_path) yield get_finder(finder_path) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 31, in wrapper File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 31, in wrapper result = func(*args) result = func(*args) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 275, in _get_finder File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 275, in _get_finder return Finder() return Finder() File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 62, in __init__ File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 62, in __init__ "The STATICFILES_DIRS setting should " "The STATICFILES_DIRS setting should " ImproperlyConfigured: The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting ImproperlyConfigured: The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload