Question

problem in serving static files in django webapp

Posted December 18, 2020 331 views
DjangoUbuntu 20.04

urls.py

from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
    path('admin/', admin.site.urls),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

settings.py

STATIC_URL = '/web/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATIC_ROOT = '/home/domain.com/public_html/web/public/static'

```**

i am using cyberpanel with openlightspeed server with contex**

context / {
type appserver
location /home/domain.com/publichtml/web
binPath /usr/local/lsws/fcgi-bin/lswsgi
appType wsgi
startupFile web/wsgi.py
envType 1
env LS
PYTHONBIN=/home/domain.com/publichtml/bin/pyhton
env PYTHONHOME=/home/domain.com/public
html/
}




my web app is not serving static files i am getting 
404
Not Found
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!