As a beginner with Django, I'm utilizing PyDev within AptanaStudio3. I followed the Django tutorials to construct the foundation of my project. However, I am now facing challenges while trying to implement basic formatting and styling using CSS.
Although the HTML page displays properly, the CSS is not being loaded (404 error). The console confirms this:
[20/Mar/2013 12:41:51] "GET /signup/ HTTP/1.1" 200 306
[20/Mar/2013 12:41:51] "GET /signup/static/signup.css HTTP/1.1" 404 2750
This is my current file structure:
Learning
- Learning
--- templates
----- 404.html
----- 500.html
--- _init.py
--- settings.py
--- urls.py
--- wsgi.py
- signup
--- static
----- signup.css
--- templates
----- signup
------- detail.html
------- index.html
------- results.html
----- __init__.py
----- admin.py
----- models.py
----- tests.py
----- urls.py
----- view.py
--- manage.py
--- sqlite.db
--- python
In the settings:
STATIC_ROOT = ''
STATIC_URL = 'static/'
STATICFILES_DIRS = ('')
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
Within my HTML template:
<html>
<head>
<title>User List</title>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}signup.css" />
...
In views.py:
def ip_address_processor(request):
return {'ip_address': request.META['REMOTE_ADDR']}
def index(request):
user_list = User.objects.order_by('name')[:5]
template = loader.get_template('signup/index.html')
context = RequestContext(
request,
{'user_list': user_list,},
[ip_address_processor])
return HttpResponse(template.render(context))
Any suggestions or insights on how to resolve this issue?