details of my code, in my settings.py i have:
BASE_DIR = Path(__file__).resolve().parent.parent
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
and this is how i tried to acces form the template:
in very first page:
% load static %
to display image,
<a class="navbar-brand" href="#"><img src="{% static 'images/main.png' %}" alt="imagetwo" width="100" height="50"></a>
anyone who can help me, please
if you need further details of the project structure, from cpanel root, mainfolder/users. users is my app. mainfolder/mydjango mydjango is my dajngo project, both django project and app is at the same directory level! The image is found in mainfolder/users/static/images/
2
Answers
You have just try load image Like,
Your code:
Try My Answer:
Follow my code, to load your images just put
/
before your folder name and after write your image name.coul’ve forgoten to add this :
to the url.py file