You can now install and run Python Apps on Hostbeak

This feature is only available for Mega and Peak Hosting Plans

On your cPanel dashboard,

Click on Setup Python App and click on Create Application

Setup Python App

 

Then Click on Create Application

Create Python Application

Set your preferred python version to the one compatible with the application you want to host.

Set the application root to the location of your application NOTE:

Your files should be in public_html, e.g /home/user/public_html/pythonapp

Set the Application URL you wish to use. In this example, we will leave the application URL as sitedemo.com.ng and type the folder we want, e.g pythonapp

Leave Application URL field empty if you want this to be in the root folder

Set the application startup file to the location of your wsgi.py file

Set the entry point to the name of your application as declared in the wsgi.py file.
E.g /home/sitedemo/public_html/pythonapp/wsgi.py

Finally set the passenger log file to the location where you want error logs to be saved

Click on Create

Create Python Application

Install requirements, dependencies, and configure your application. (From cPanel) After the application is created, it displays more details about the created application. If it doesn't for you, click on the edit icon 

Input the full path to your requirement.txt file in the CONFIGURATION FILES option and click on the add button.

After the required file or files depending on your application is added, click on the RUN PIP INSTALL button and select the file you added to install requirements and dependencies for the application.

After requirements have been installed successfully, you can then go ahead to run any other scripts as directed by the application developer using the EXECUTE PYTHON SCRIPT option. Example of such scripts include manage.py migrate manage.py runscript many_load ….. Etc

NOTE: manage.py runserver will not work on cPanel because cPanel handles that part for you already.

Restart the application and access via the application URL 

NOTE: Please ensure you add your application URL in allowed host in your application settings, you will not need to do so if you have ALLOWED_HOSTS = [ '*' ] in your settings file.

Install requirements, dependencies, and configure your application. (From ssh) After the application is created, login to your Cpanel account via SSH 

From the details of the created application, copy the command to enter into the virtual environment. E.g source /home/sitedmeo/virtualenv/public_html/pythonapp/3.7/bin/activate && cd /home/sitedemo/public_html/pythonapp

After running all required scripts, go back to cPanel and restart the application. 

Create Python App

NOTE: Please ensure you add your application URL in the allowed host in your application settings, you will not need to do so if you have ALLOWED_HOSTS = [ '*' ] in your settings file. 

Python App It works in CPanel

Byla tato odpověď nápomocná? 120 Uživatelům pomohlo (479 Hlasů)