navidabasi
navidabasi

Reputation: 181

what i need to do for loading static

Hey everybody i have a problem with this code which i try to run on local host server , in this situation im followin an online project over youtube and he is trying to make an online resume, at the start we tried to make a simple home template which i stock in it so if u can help me to fix the problem in which cause to rise this error

'Static' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log static tz

and this the code itself:

{% load  Static %}
<link href="{% static '/css/main.css' %}" rel= "stylesheet" type="text/css">

<h3> Hello world! <h3>

<img src="{% static 'images/me.profile.jpg'%}"

this is the setting.py by the way:

STATIC_URL = '/static/'
MEDIA_URL = '/Images/'


STATIC_DIRS= [
    os.path.join(BASE_DIR, 'static') 
]

Upvotes: 0

Views: 241

Answers (2)

Kashif
Kashif

Reputation: 1464

it's a recommended way or templating engine rules first make folder template or static folder then in template make a new folder app_name. then in app_name work on static files. in your app make a folder name static in it you make another folder name of your app_name init you work on your static files e.g static/app_name/images/me.profile.jpg maybe problem also in this name me.profile.jpg please change it to profile.jpg. you don't need to change anything in setting.py because static root default set .

{% load  static %}
<link href="{% static 'app_name/css/main.css' %}" rel= "stylesheet" type="text/css">

<h3> Hello world! <h3>

<img src="{% static 'app_name/images/me.profile.jpg'%}" > 

Upvotes: 0

michael hannan
michael hannan

Reputation: 173

The tag is {% load static %} without the capital S.

Upvotes: 1

Related Questions