Hi Singh, I have configured static file for my projects as follows. In settings.py
import os PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media') MEDIA_URL = '/site_media/' STATIC_ROOT = '' # URL prefix for static files. # Example: "http://media.lawrence.com/static/" STATIC_URL = '/static/' # Additional locations of static files STATICFILES_DIRS = ( # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) and urls.py urlpatterns = patterns('', # For static file serving in development. Deactivate in production environment (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.MEDIA_ROOT }), ) I believe it may help you.. On Mon, Sep 10, 2012 at 12:53 AM, Karambir Singh Nain <akaram...@gmail.com>wrote: > I have a fairly simple django project having some views, templates and > static files like css and images. My settings file include : > > STATIC_ROOT = '/home/karambir/Codes/projects/cdi/cdi/static' > STATIC_URL = '/static/' > STATICFILES_DIRS = ( > '/home/karambir/Codes/projects/cdi/cdi/data', > ) > TEMPLATE_DIRS = ( > '/home/karambir/Codes/projects/cdi/cdi/templates' > ) > > So I serve static files with {{ STATIC_URL }} in the templates. And it is > working fine when DEBUG is TRUE but every static file breaks when debug is > set to false. Then I tried with django admin, it was also broken. So I run > a ./manage.py collectstatic command. And then admin css works fine but my > own files still not. I saw in the url of the loaded html page and it shows > correct url and it is not loading. > How can I know what is the main problem. What changes takes place when > debug is set to false? > (I'm running django1.4) > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/fWCsL9PUI1EJ. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Thanks & Regards Stephen S Website: www.f2finterview.com Blog: blog.f2finterview.com Tutorial: tutorial.f2finterview.com Group: www.charvigroups.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.