Deploy web app django to cpanel
412
Introduction:
Deploying a Django web application to cPanel can seem like a daunting task, especially for those who are new to web development. However, with the right guidance, it can be a straightforward process. In this article, we will walk you through the steps necessary to deploy your Django web application to cPanel, making it accessible to the world.
Step 1
Create a file in your project folder (where manage.py file is) called passenger_wsgi.py and paste the code below
from projectname.wsgi import application
Note: projectname should be the name of your project
Step 2:
Login to your cpanel account
Step3:
In your cpanel, click "Setup python app"
Step 4:
Click on Create Applicaiton
Fill the following details
Application root: myproject (you can give it any name)
Applicaiton URL: Select your url
Application Startup file: passenger_wsgi.py
Application Entry Point: application
Step5:
Click that area to copy the link to our virtual environment, check the image below
Step 6:
Go to your home page in your cpanel, click on terminal
Step7:
On the terminal, paste the link you just copied
Step 8: Makemigrations, Migrate and collectstatic
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py collectstatic
Step 10: Restart the server
In your python application area, click the restart botton and your website is live.
Conclusion:
In conclusion, deploying a Django web application to cPanel is a relatively simple process that can be completed with a few basic steps. By following the instructions outlined in this article, you can take your locally developed Django application and make it available to the public through your cPanel account. With your application now live, you can share it with the world and start receiving feedback from users.