TransWikia.com

cant load static file in django

Stack Overflow Asked on November 29, 2021

I copied a HTML page with many images and javascript codes.

I created the static folder and did everything that is needed, and when I’m tying to load the source with static tag such as:

<link rel="stylesheet" type="text/css" href="{% static 'styles/bootstrap4/bootstrap.min.css' %}">

I’m still getting an error:

GET http://127.0.0.1:8000/static/styles/bootstrap4/bootstrap.min.css net::ERR_ABORTED 404 (Not Found)

All it did is to add static in the url and I dont understand why?

I cant find how to load jinja in pycharm so my tags are white.

One Answer

Have you looked at the Django Documentation?

Serving the files

In addition to these configuration steps, you’ll also need to actually serve the static files.

During development, if you use django.contrib.staticfiles, this will be done automatically by runserver when DEBUG is set to True (see django.contrib.staticfiles.views.serve()).

This method is grossly inefficient and probably insecure, so it is unsuitable for production.

See Deploying static files for proper strategies to serve static files in production environments.

Answered by Uzun Emre on November 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP