python django - page not found error (404)- static error -
i somehow got application running on django (new python , django) , although page loads default url (127.0.0.1:8000) load css files. produces following error css files directly accessed.
page not found (404) request method: request url: http://127.0.0.1:8000/static/css/bootstrap.min.css 'css\bootstrap.min.css' not found you're seeing error because have debug = true in django settings file. change false, , django display standard 404 page.
here settings.py page:
static_url = '/static/' # template location template_dirs = { os.path.join(os.path.dirname(base_dir), "whattheheck", "static", "templates"), } if debug: media_url = '/media/' static_root = os.path.join(os.path.dirname(base_dir), "whattheheck", "static", "static-only") media_root = os.path.join(os.path.dirname(base_dir), "whattheheck", "static", "media") staticflies_dirs = ( os.path.join(os.path.dirname(base_dir), "whattheheck", "static", "static") )
and here urls.py page:
from django.conf.urls import patterns, include, url django.conf import settings django.conf.urls.static import static django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: url(r'^$', 'signups.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), ) if settings.debug: urlpatterns += static(settings.static_url, document_root=settings.static_root) urlpatterns += static(settings.media_url, document_root=settings.media_root)
can please?
after add kind of static files project should execute
python manage.py collectstatic
Comments
Post a Comment