не могу получить доступ к статике. Когда коннекчусь к серверу, в логе
[10/Feb/2017 15:13:41] "GET / HTTP/1.1" 200 147
[10/Feb/2017 15:13:41] "GET /static/samples/pic.png HTTP/1.1" 404 1665
PROJECT_DIR = os.path.dirname(__file__)
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
MEDIA_URL = '/media/'
STATICFILES_DIRS = (
os.path.join(PROJECT_DIR, 'staticfiles'),
)
views.py
def index(request):
html = '''
<html><head></head>
<body>
<img src="static/samples/pic.png" alt="not load :("/>
</body>
</html>
'''
return HttpResponse(html)
urls.py
urlpatterns = [
url(r'^$', views.index),
] +static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
proj_dir/
--manage.py
--proj_dir/
----settings.py
----views.py
...
--static/
----samples/
...
Перемещено leave из development