Hello World!

56 views
Skip to first unread message

Alvaro Nascimento

unread,
Oct 13, 2023, 9:14:44 AM10/13/23
to Django users
i have an issue with my Django site, 

on loading staticfiles, it does 404 error.

but in production everything works fine.

Migui Galan

unread,
Oct 13, 2023, 9:41:29 AM10/13/23
to django...@googlegroups.com
Hi Alvaro, try to check your STATICFILES_DIR, STATIC_ROOT and STATIC_MEDIA path. maybe they are not pointing to the correct path

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f6e31790-20fc-40db-b22a-bc86a3d9738an%40googlegroups.com.

Sathya Narayana Rangappagari

unread,
Oct 13, 2023, 9:50:39 AM10/13/23
to django...@googlegroups.com
Hey Alvaro, If you're encountering 404 errors for static files in your Django development environment but not in production, start by reviewing your project's settings in settings.py to ensure proper static file configurations. Run the python manage.py collectstatic command in your development environment to collect static files. Make sure to double-check your templates to use the {% static %} template tag correctly for generating static file URLs. Make sure your static files are organized correctly in your project's directory structure and that your development server is set up to serve static files. Verify your URL patterns for handling static files. Clear your browser cache, and check your logs for any error messages that might provide clues to the issue.

Onjomba Felix

unread,
Oct 13, 2023, 9:57:27 AM10/13/23
to django...@googlegroups.com

Look at how you configure your static files and also the deburg mode of your system

Settings.py

DEBUG = True
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]

main urls.py 

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... your other URL patterns ...
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)


Then Run 
 python manage.py collectstatic



Mithilesh Rawani

unread,
Oct 13, 2023, 10:15:00 AM10/13/23
to django...@googlegroups.com
404 screenshot share this group 

Adesewa Lola

unread,
Oct 14, 2023, 9:05:54 AM10/14/23
to django...@googlegroups.com
i have an issues with my django site 

All i want to do is to add a mail so whenever the user click the sign up button the user should receive a mail like thanks for signing up 

but mine is not working 

oduwole samuel

unread,
Oct 14, 2023, 9:12:52 AM10/14/23
to django...@googlegroups.com
How can I become an execpt in Django


Sebastian Jung

unread,
Oct 14, 2023, 9:31:39 AM10/14/23
to django...@googlegroups.com
Write raise Exception ("New Error") im your views.py 
Then you have a exception

Reply all
Reply to author
Forward
0 new messages