Django Rest deployment on CPanel

83 views Asked by At

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.

1

There are 1 answers

1
Mahammadhusain kadiwala On

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