I am new to Django. I'm losing my mind trying to figure out what is happening with static files (css and images).
A summary of the problem is the following ... when I use static views from a third-party application (Haystack) I cannot use static files.
My project has this directory structure:
1001empbr (name of the folder for the project) | |------ 1001emp (name of the django project) | |------ 1001empbr (name of my App) |------ site_media (folder with static files CSS/JPG/GIF) |------ templates (folder with the templates)
When I use urlpatterns (urls.py) how it works fine:
import os.path
Here is the server activity:
0 errors found Django version 1.3.1, using settings 'emp1001.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. [17/Nov/2011 10:15:30] "GET / HTTP/1.1" 200 2816 [17/Nov/2011 10:15:30] "GET /site_media/estilos.css HTTP/1.1" 200 6894 [17/Nov/2011 10:15:30] "GET /site_media/pgiframe.css HTTP/1.1" 200 1345 [17/Nov/2011 10:15:31] "GET /site_media/logo1.gif HTTP/1.1" 200 4358 [17/Nov/2011 10:15:31] "GET /site_media/fundo1.jpg HTTP/1.1" 304 0 [17/Nov/2011 10:15:31] "GET /site_media/form.gif HTTP/1.1" 304 0 [17/Nov/2011 10:16:20] "GET /iframe/ HTTP/1.1" 200 1874 [17/Nov/2011 10:16:20] "GET /site_media/close.gif HTTP/1.1" 200 124 [17/Nov/2011 10:16:20] "GET /site_media/banner.jpg HTTP/1.1" 200 12538 [17/Nov/2011 10:16:20] "GET /site_media/logo2.gif HTTP/1.1" 200 3418 [17/Nov/2011 10:16:20] "GET /site_media/imgs/fundo1.jpg HTTP/1.1" 404 1753 [17/Nov/2011 11:20:06] "GET / HTTP/1.1" 200 2816
When I use static views from Haystack:
import os.path
Some time after watching, I get the following:
0 errors found Django version 1.3.1, using settings 'emp1001.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. [17/Nov/2011 11:50:25] "GET /resultados/?q=m%C3%A9dico HTTP/1.1" 200 10634 [17/Nov/2011 11:50:25] "GET /site_media/estilos.css HTTP/1.1" 500 85526 [17/Nov/2011 11:50:26] "GET /site_media/pgiframe.css HTTP/1.1" 500 85548 [17/Nov/2011 11:50:26] "GET /site_media/logo2.gif HTTP/1.1" 500 85067 [17/Nov/2011 11:50:27] "GET /site_media/banner.jpg HTTP/1.1" 500 85315 Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1225ed0>> Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/abrt_exception_handler.py", line 147, in <lambda> sys.excepthook = lambda etype, value, tb: handleMyException((etype, value, tb)) TypeError: 'NoneType' object is not callable Original exception was: Traceback (most recent call last): File "/home/andre/python_virtualenv/lib/python2.6/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run run(self.addr, int(self.port), handler, ipv6=self.use_ipv6) File "/home/andre/python_virtualenv/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 696, in run httpd.serve_forever() File "/usr/lib64/python2.6/SocketServer.py", line 224, in serve_forever r, w, e = select.select([self], [], [], poll_interval) AttributeError: 'NoneType' object has no attribute 'select'
Any clue on what should be causing this?
Best wishes,