skip to Main Content

I am working on Django Rest project and it’s admin side is working fine and properly loading with their static files on local sever. I tried to deploy my project on CPanel where I setup my python setup application successfully but when I load Django admin side with live url link it only shows textfields without classes applied.

Django-admin

Live django endpoint from where django admin tries to load static files is like this:

https://example.com/api/static/admin/css/base.css

Where api is the Application url of my Python app that I setup on CPanel.

I also ran this command:

python manage.py collectstatic 

but still server is not able to locate the files.

2

Answers


  1. Follow steps:

    • Step:1
    # STATICFILES_DIRS = [BASE_DIR / 'static']  # comment this
    STATIC_ROOT = BASE_DIR / 'static' # Add this
    
    • Step:2

    run command python manage.py collectstatic

    • Step:3

    Reload app

    Login or Signup to reply.
  2. Copy your static folder inside public_html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search