Django: Static_url Adds Appname To The Url
I have configured my static settings like so: STATIC_ROOT = os.path.join(SITE_ROOT, 'static') STATIC_URL = '/static/' STATICFILES_DIRS = ( ('js', os.path.join(STATIC_ROOT, 'js'
Solution 1:
Since you're using the django built-in developement server, try to remove the following line from your urls.py
:
urlpatterns += staticfiles_urlpatterns()
In production, you'de better not serve static files with django, so use the collectstatic
command.
edit
Baca Juga
- Django Model: Valueerror: Missing Staticfiles Manifest Entry For "file_name.ext"
- My Link To Manifest.json In Index.html Works When I Run React Script 'yarn Start', But Not When I Run 'python3 Manage.py Runserver'
- Django | Joined Path Is Located Outside Of The Base Path Component {% Static Img.thumbnail.url %}, Error 400 With Whitenoise
If settings.py
, try something like this:
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '../../static')
STATIC_URL = '/static/'
Post a Comment for "Django: Static_url Adds Appname To The Url"