'how can I change css Request url in nginx wit django
Below is my Nginx config
location /static {
alias /srv/django_site/mysite/static/;
}
when I approach www.mysite.com/admin
browser request css file 'www.mysite.com/admin/css/~.css'
But when I approach www.mysite.com
browser request css file like below
www.mysite.com/static/styles.css so I got 404 error.
I want to change this request url like this www.mysite.com/static/home/static
How can I fix this?
Below is my url.py and settings.py
urlpatterns = [
path('', include('home.urls')),
path('accounts/signup', lambda requests: redirect('')),
path('activate/', lambda requests: redirect('')),
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls')),
]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
###
home/url.py
urlpatterns = [
path('', views.MainView.as_view(), name = 'homepage'),
STATIC_URL = 'static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
