If you are on Windows, I recommend to use PuTTY program. We need to make a ssh connection to our server. We will need to use shell commands anyway, so let’s go to command line straight away. Let’s do it in traditional way, running shell command. Yes, we can do it directly in web interface (we need to type ‘requirements.txt’ - if we have this file in root subdirectory – in ‘Configuration files’ section, click ADD, then click ‘Run Pip install'), but we won’t do it this way. How to do this, is not particularly clear from cPanel web interface. Once we have a virtual environment, we have to install needed packages. Upload this file to root project directory () if it is not already there. Numbers may differ, there may be more lines. The content if this file should look something like this: asgiref=3.2.3 For this, go to your project directory on your local machine, activate your project virtual environment (running command source /path/to/ENV/bin/activate or similar method), then run command: pip freeze > requirements.txt But if there is no such file, you need to create it. Most probably you already have this file in you project directory on your local machine, so it is already uploaded to the server. We will need requirements.txt file which should also live in root project directory. (Ensure that manage.py file resides directly in directory) This will be the root directory for our project, corresponding to ‘outer mysite/’ directory mentioned in Django Polls tutorial. ) You can even use cPanel File Manage to upload files, but this is too cumbersome, in my opinion. Please notice that you need to use port 88 for SFTP, not standard port 22. (You can also connect via SFTP using the same sPanel credentials. Remember to use cPanel username and password (the ones you can find on your Welcome email), not HostPresto! Client area email/password. You can find all needed information (FTP host, port, credentials) in FILES – FTP Accounts section of cPanel. To upload files we will use any FTP client. This means we have successfully created a virtual environment for our Python application. Last thing – it is sensible to name a log file (Passenger log file) – enter /home/yourname/polls.logĪgain, point your browser to (or refresh page if you still have it in one of the tabs). Leave Application startup file and Application Entry point empty – the system will create this file by its own rules and let it do it. Select ‘’ as Application URL in the next line. In Application root type in the directory name we have created in the previous step, relatin to your home directory – that is, just ‘’. Select the latest Python version in the first field. The setup page isn’t very intuitive, in my opinion. HostPresto! Uses software from Passenger () to set up Python applications. In cPanel go to SOFTWARE section and select Setup Python App. This is how an empty website looks like on HostPresto! Setting up Python application If you point your browser to, most probably you will see a directory listing – something like this: Document Root will be auto populated with ‘’. Select your main domain (youname.xyz) from Domain dropdown. Log in into cPanel and click on Subdomains in DOMAINS section. Adding a subdirectory like is less convenient, in our opinion. ![]() You may also have some website sitting there already. Setting up the tutorial project in the root domain may pollute your space. ![]() For this tutorial, we will create a subdomain We think this is the most natural and straightforward method. Suppose you have a domain registered with HostPresto! - yourname.xyz (BTW. Let’s start to set up our HostPresto! Environment. The project should have the following or similar structure on your machine: └───mysite Here we will assume that you have the project set up into your local virtual environment. Please refer to official docs to set up local development environment and build the project. (How to run the Polls project locally is out of scope of this tutorial. If you do not have the project on your machine, you may just clone my GitHub repository: Now we will deploy this project to HostPresto! Moreover, you should have this project on your local machine up and running, using Django built-in development webserver. If you have started learning Django framework, you should be familiar with this tutorial project. In this tutorial we will deploy Django Polls project from official Django tutorial to the HostPresto!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |