Static files configuration

79 views
Skip to first unread message

Yash Garg

unread,
Dec 17, 2019, 2:20:50 PM12/17/19
to Django developers (Contributions to Django itself)
I have to display a HTML page with its supporting css, js and images. So i create a template folder to put HTML in it then i create a static folder in which i create css, js and img folder and put related files into these folders.
then I configure the
Settings.py

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

#STATIC_URL = '/static/'

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


.html file 

{% load staticfiles %}
<link href="{% static 'css/style.css' %}" rel="stylesheet">

views.py

def Index(request):
return render(request,'Teenager Startup.html')

please help me where i'm not getting the point.

Adam Johnson

unread,
Dec 17, 2019, 4:19:40 PM12/17/19
to django-d...@googlegroups.com
Hi!

I think you've found the wrong mailing list for this post. This mailing list is for the development of Django itself, not for support using Django. This means the discussions of bugs and features in Django itself, rather than in your code using it. People on this list are unlikely to answer your support query with their limited time and energy. Read more on the mailing lists at https://www.djangoproject.com/community/

For support, please use the NEW Django forum at https://forum.djangoproject.com , django-users mailing list, or IRC #django on Freenode, or a site like Stack Overflow. There are people out there willing to help on those channels, but they might not respond if you don't ask your question well. Stack Overflow's question guide can help you frame it well: https://stackoverflow.com/help/how-to-ask .

Also if you haven't read it, please take a look at Django's Code of Conduct: https://www.djangoproject.com/conduct/ . These are our "ground rules" for working well as a community, and will help you get the most out of Django and our fantastic community.

Thanks for your understanding,

Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/d3087903-f25d-45ad-8100-5f786d820708%40googlegroups.com.


--
Adam
Reply all
Reply to author
Forward
0 new messages