More and more people are using git to manage their code versions. We at Webhostpython have made deploying your git repositories as a Python/Django app on your cPanel a straightforward task.

Prerequisites

  • You need your Python/Django app set up to use git. If you have another version control system other than git, such as Mercurial or Subversion, this method would not work.
  • Before setting up the app, please run pip freeze > requirements.txt to make sure you have the latest packages ready to be installed on your cPanel server. (Only if you are using pip)
  • Then, commit all your changes and push to Github or wherever your repository is hosted.

Setting up the git repository on cPanel

  1. On your cPanel, please click on the Git Version Control icon


  2. On the next screen that appears, click the Create button
  3. The following screen appears


  4. Copy and paste the github or your git hosts clone url for your repository on the Clone URL text box. On Github, you can obtain the url from here


  5. For the Repository Path you can input a folder name which will be created and your project will be housed there.
  6. Finally, type a name for your repository and hit the Create button.

Setting up the Python/Django application to run

For a how to guide on this, please visit our tutorial http://blog.webhostpython.com/2020/02/07/getting-started-with-python-django-hosting-plan/

Making changes to code / Maintaining the code

Since you are using a git repository, please refrain from editing your code using either cPanel File Manager or via FTP.

The best practice is to do the changes on your local computer and then pushing your changes to the git repository as you would usually do.

Then to make your changes available on your cPanel server;

  1. Open the Git Version Control app on the cPanel dashboard.
  2. Click on the Manage button for your repository
  3. On the screen that appears next, please click on the Pull or Deploy tab to get to the next screen


    Click on the Update from Remote button to download the latest code changes =)