I can load static files locally with 'runserver' but not in production. I successfully manage to load templates in production, but not static files.
in the .html page I included the lines:
<!DOCTYPE html>
{% load staticfiles %}
... ...
<img src="{% static "images/mypic.jpg" %}" alt="this pic" />
my settings in settings.py include these lines
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_DIR = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [STATIC_DIR, ]
STATIC_URL = '/static/'
and in urls.py I have:
from django.conf.urls.static import static
and
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^pages/', include('pages.urls')),
url(r'^admin/', admin.site.urls),
url(r'about^$', views.about, name='about'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
I've been trying for hours, any idea why I can't access them?