For security purpose these settings should be on debug=True
On production you should change those urls to have dedicated server for static files like Nginx
On production you should change those urls to have dedicated server for static files like Nginx
On 30 Jun 2021, 07:28 +0300, patel dhruvish <pateldhruvish612000@gmail.com>, wrote:
Do you add static code in setting.py and urls.py? Code is here....Setting.py:-Project urls.py:-Then load static file with format like:-STATICFILES_DIRS = [ BASE_DIR / "static", '/var/www/static/', ]Project urls.py:-from django.conf import settings from django.conf.urls.static import static urlpatterns = [ # ... the rest of your URLconf goes here ... ]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)Or+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)Then load static file with format like:-{% load static %} <img src="{% static 'my_app/example.jpg' %}" alt="My image">
--On Wed, Jun 30, 2021, 09:47 UJJWAL AGRAWAL <ujjwalgl.sgi@gmail.com> wrote:--Dear all I am facing one problem.When I am writing {%load static%} rather than getting executed it is getting displayed as simple text on the HTML output screen
Please provide me the solution.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALQ%3D5fyZPWiBGnY6VJB1_C6Rb1Ls4dfsGfTef%2BBSqi1BXKHtfw%40mail.gmail.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANMvxF0juEz51Pua5PRAR8uNjKPsSGVkZUnDYjTTtve7hfObag%40mail.gmail.com.
No comments:
Post a Comment