Activate Virtual enviornment in Cpanel without SSH
Asked Answered
D

0

6

I am deploying a django based web application. My hosting provider doesn't allow SSH access. So I deployed my application via python setup app. But it doesn't load static files altough it loads media files.

so i wanted to execute "python manage.py collectstatic"

But Only way to execute python command is through python setup app. But with the latest upgrade of Cpanel Python Setup Interface is fully different. I can't find a way to activate my virtualenv and execute command.

#My Static configuration in Settings.py
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static')


#My Urls.Py

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

urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)


#I also tried
STATIC_URL = '/static/'
STATIC_ROOT = '/home/user/public_html/static'

https://prnt.sc/pg6uzy

This is the screenshot of Latest Cpanel. How to activate virtualenv and Execute Command.

Dynamometry answered 7/10, 2019 at 22:43 Comment(3)
you should use your production server to serve static files.Inaccuracy
I am using my producation server to serve static files. All I need to do is run collectstatic command. But I can't find a way to execute this command via cpanel.Dynamometry
did you found any solution.? if yes please give the answer of your own question. thanksThrombophlebitis

© 2022 - 2024 — McMap. All rights reserved.