I have looked every where possible, I have not found the answer to the issue I'm having. I spent hours in this and find not avail.
My front end was displaying all images and css with a static folder under the project or under the app tree.
After I did the changes to use a dynamic url, and created the static folder out of the project folder(one folder down) did collectstatic all of sudden my images have disappeared, css still works either direct path'd or dynamically.
I have tried the same with images, direct path(as a copy of the folder still remains in the project folder) the direct path does not work, neither the dynamic path.
Its not returning 404 either, on the first load, it returns 200, on second 304 as if the image was there on screen, but it isnt. There is just no errors, but darn image is not there. What puzzles me is that the css works, but image does not display.
Bellow is my code.
---|settings.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"),
#'/var/www/static/',
]
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_cdn")
---|url.py
if settings.DEBUG == True:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
---|main.html (template)
{% load staticfiles %}
<img src={% static "images/banner_top.png" %}>
or
<img src="..static/images/banner_top.png">
or
<img src="static/images/banner_top.png">
on browser the image doesn't show, but back end shows 200 and right path to image.
http://127.0.0.1:8000/static/images/banner_top.png
[22/Oct/2016 22:32:10] "GET /static/images/banner_top.png HTTP/1.1" 200 0
Here is the HEADER
GENERAL
Request URL:http://127.0.0.1:8000/static/images/banner_top.png
Request Method:GET
Status Code:200 OK
Remote Address:127.0.0.1:8000
REQUEST
Content-Length:0
Content-Type:image/png
Date:Sun, 23 Oct 2016 08:06:17 GMT
Last-Modified:Fri, 21 Oct 2016 06:54:06 GMT
Server:WSGIServer/0.1 Python/2.7.10