Skip to content

Instantly share code, notes, and snippets.

@raykibul
Last active July 4, 2021 07:01
Show Gist options
  • Select an option

  • Save raykibul/f160aede02c1676f67d7804b27194989 to your computer and use it in GitHub Desktop.

Select an option

Save raykibul/f160aede02c1676f67d7804b27194989 to your computer and use it in GitHub Desktop.
How to host django applicaiton on shared server
1. Create an python app in your cpanel , with the passenger logs and your folder name
2. copy the command provided after you created the python app
source /home/raykzpwp/virtualenv/telecom.raykibul.com/3.8/bin/activate && cd /home/raykzpwp/telecom.raykibul.com
3. go to your terminal on cpanel
4. paste the source command you copied
5. now install django using pip install django command
6. create new project using django-admin startproject projectname .
7. now replace your main wsgi file , replace with "from projectname.wsgi import application"
8. now add your domain name with www and without www in allowed host
9. add media , asset and static files directories
Using these lines
STATICFILES_DIRS=[str(BASE_DIR) +"/assets",]
STATIC_ROOT='/home/raykzwp/public_html/telecom.raykibul.com/static'
MEDIA_ROOT='/home/raykzwp/public_html/telecom.raykibul.com/media'
10. command to collect statics python manage.py collectstatic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment