I'm new to Django. I have some difficulties, my static files are not loaded properly.
My project directory looks like this:
- myNewWebSite
- myNewWebSite
- home
- static
- css
- home.css
- css
- templates
- home
- index
- home
- manage.py
- init.py
I configured following settings in myNewWebSite/settings.py:
PROJECT_APP_PATH = os.path.dirname(os.path.abspath(__file__))
PROJECT_APP = os.path.basename(PROJECT_APP_PATH)
PROJECT_ROOT = BASE_DIR = os.path.dirname(PROJECT_APP_PATH)
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/"))
My template (templates/home/index.html):
{% load staticfiles %}
<html>
<head>
<link rel="stylesheet" type="text/css" href="{% static 'css/home.css' %}" />
</head>
<body>
<h1 id="test">Hello World, This is my first website in django</h1>
</body>
</html>
My styles in static/css/home.css:
body {
background-color: red;
}
#test {
border: 10px solid green;
}
I cannot see any effect of these changes. Only the message Hello World,...
shows up. The output shows this:
[08/Jun/2016 20:36:04] "GET /myhome/ HTTP/1.1" 200 178
[08/Jun/2016 20:36:04] "GET /static/css/home.css HTTP/1.1" 301 0
[08/Jun/2016 20:36:04] "GET /static/css/home.css/ HTTP/1.1" 404 4930
I have set DEBUG = False
in settings.py and local_settings.py(in Mezzanine).
What is the problem?
UPDATE
Running the development server with --insecure
parameter solved the problem.
Thanks to GDorn
IF DEBUG = False
THEN python manage.py runserver --insecure