I'm 2hours stuck in a issue about STATIC_URL and STATIC_ROOT when I try to make run the webapp on my server at webfactional.
when I load the webpage all the requests works well, except by the fact that any link with {{ STATIC_URL}} is working or loading.
So a common error that appears on firebug is:
GET http://mydomain/static/extras/h5bp/js/libs/modernizr-2.5.3.min.js 500 (Internal Server Error)
My setup is:
urls.py I did nothing, and there's nothing about static files.
settings.py DEBUG = False
STATIC_ROOT = '/home/mydomain/webapps/static_app/'
STATIC_URL = 'http://mydomain/static/'
STATICFILES_DIRS = ()
views.py view example
@csrf_exempt
def IndexView(request):
try:
request.user.is_authenticated()
except AttributeError:
return render_to_response('index.html',
{'request': request,},
context_instance=RequestContext(request))
return render_to_response('index.html',
{'request': request, 'profile' : request.user},
context_instance=RequestContext(request))
index.html a part of code not found
<script src="{{ STATIC_URL }}extras/h5bp/js/libs/modernizr-2.5.3.min.js"></script>
well, I follow all the points of: https://docs.djangoproject.com/en/1.4/howto/static-files/ and this another one: http://docs.webfaction.com/software/django/getting-started.html
I'm using the correct installed apps, middlewares, template_contexts.
If I'm missing something please help me to figure out.
Thanks in advance!
--edit
I have to say, if I just change the DEBUG = True will works fine.
because on urls.py I have this piece of code:
if settings.DEBUG:
# static files (images, css, javascript, etc.)
urlpatterns += patterns('',
(r'^media/(?P<path>.*)/$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT}))