Python

SanBox Python App deployment and PIP management.

Deploy SandBox Python Apps

How to deploy Python apps on Eenos?

This document will help you deploy a Python app on your eenos hosting control panel.  Eenos control panel is a modern hosting control panel designed for modern apps. 

Features Of Eenos Python App Management

Eenso control panel has the following wonderful features for managing Python apps easily.

Every Eenos Python app has its own virtual environment.  So, migration and transfer of hosting accounts are easy.

To start deploying Python app logins to your eenos control panel, go to the following Page:

Python -> Python SandBox Apps

Setup Python SandBox and Install Apps

Now you need to fill out the simple form  as follows,

Choose Domain For Python App: Select a domain or subdomain for deploying a Python app. This is the website url you are going to deploy the app.

Choose Python Version: Select a suitable version of Python distribution to set the Sandbox virtual environment,

Choose Python App: Select what type of Python app are you hosting.   Based on this selection, you may need to configure the app-specific settings also.

App Startup Script: The startup entry script name. It is normally a wsgi script  ( eg: wsgi.py ) 

Public Folder Name: This is the folder into which you upload the static files like CSS, js, images, etc. It is directly under your website document root.

Project Publicity Type: This option will help you to set up the project in either production or development mode.

Install Demo App: This will help you to install the selected demo app.  If you have already developed the app, you can select the option no and upload the files yourself.

Now, Click the button  Deploy App and it will start deploying the app.

Manage Python App From Shell

If your hosting account has enabled SSH access, you can easily manage your Python app from the shell too. You may contact your hosting server and enable the ssh shell access to access this feature. 

You can login to the server with the ssh client from your desktop.

Here, we are going to use the following details to show you how to manage Python apps from the eenos sever shell virtual environment. 

 Example eenso user:  myuser

Example python  app domain: django.mydomain.com

Example  eenos ssh server port: 22

Login to the SSH terminal

Login to the SSH server with the following command,

ssh myuser@django.mydomain.com -p 22

Activate Python  Virtual Environment

Activate the Virtual Sandbox  Python environment for the domain django.mydomain.com as follows,

myuser:$ ~ $ source  ~/.sandbox/python/django.mydomain.com/bin/activate
(django.mydomain.com) myuser:$ ~ $

Done! You are on the domain's Python environment and you can start working on your Python app from the terminal. 

See, the usage of some example commands below,

Check the Python version for the domain,

(django.mydomain.com) myuser@:$ ~ $ python -V
Python 3.8.12
(django.mydomain.com) myuser@:$ ~ $ 

Run the PIP command on the domain as follows,

(django.mydomain.com) myuser@:$ ~ $ pip list
Package             Version
------------------- ---------
anyascii            0.3.0
asgiref             3.5.0
backports.zoneinfo  0.2.1
beautifulsoup4      4.9.3
certifi             2021.10.8
charset-normalizer  2.0.12
click               8.0.4
Django              4.0.3
django-filter       21.1
django-modelcluster 5.2
django-taggit       2.1.0
django-treebeard    4.5.1
djangorestframework 3.13.1
draftjs-exporter    2.1.7
et-xmlfile          1.1.0
Flask               2.0.3
html5lib            1.1
idna                3.3
itsdangerous        2.1.1
Jinja2              3.0.3
l18n                2021.3
MarkupSafe          2.1.0
mysqlclient         2.1.0
openpyxl            3.0.9
Pillow              9.0.1
pip                 21.3.1
psycopg             3.0.9
psycopg2            2.9.3
pymongo             4.0.2
pytz                2021.3
requests            2.27.1
setuptools          58.3.0
six                 1.16.0
soupsieve           2.3.1
sqlparse            0.4.2
tablib              3.2.0
telepath            0.2
urllib3             1.26.8
uWSGI               2.0.20
wagtail             2.16.1
webencodings        0.5.1
Werkzeug            2.0.3
wheel               0.37.0
Willow              1.4.1
xlrd                2.0.1
XlsxWriter          3.0.3
xlwt                1.3.0
(django.mydomain.com) myuser@:$ ~ $ 

Deactivate the Python Virtual Environment

You can deactivate the current working Python shell virtual environment using the following command

(django.mydomain.com) myuser@:$ ~ $ deactivate 
myuser@:$ ~ $ 

This command will return you to the default terminal. Now you can switch to another Python app from the same terminal.

Switch Python SandBox Virtual Environment

If we have the Flask app on the  domain flask.mydomain.com on the same eenos hosting account, we can switch to the virtual environment for the Flask app as follows,

myuser:$ ~ $ source  ~/.sandbox/python/flask.mydomain.com/bin/activate
(flask.mydomain.com) myuser:$ ~ $

With the above steps, you can start deploying Python apps.  The next session will help you to manage Python pip modules from the eenos control panel.

Python PIP Management

Manage Python Modules

This page will help you to manage pip modules on your Python apps. You can install, update, and uninstall Python modules from this page.

Location :

Python -> Python PIP Management

Click the button Manage Pips for the respective Python app, it will take you to your pip management page.

Install New Pips

You can enter the contents of the requirements.txt file in this file to start installing the pip module on your domain.

Update  Single Pip

To update a single Python module, click the Update button for the respective Python module.

Bulk Update Pips

To update multiple pip modules, select the Python modules and click on the Bulk Update button.

Uninstall Single Pip

To remove a single pip module, click the Remove button for the respective Python module.

Bulk Uninstall Pips

To remove multiple pip modules, select the Python modules and click the Bulk  Remove button.

You can also manage the Python modules from the shell if your hosting account has the shell access enabled.



Python & SandBox Apps

Manage SandBox Python Apps

This page will give an easy interface for managing your Python sandbox apps.  To access the apps, go to the following page,

Python -> Python & SandBox Apps

This page provides the following tools :

Change the Python Version on the App

To change the Python version of a SandBox app, click the Python icon on the respective app. Then select the Python version. You can also choose to reinstall Sandbox.

If you change the Python version, you may need to reinstall Sandbox to set up the Python modules.

Changing the Python version of a production app may break the app if the requirements are not met.

You need to make sure to install all pips after changing the Python version.

Change Startup Script

This option will help you to change the entry point script or startup script on your Python project.  It is a uWsgi script name.

Examples: wsgi.py, app.py, uwsgi.py, etc.

Change Public Folder

This folder contains the static files of your app like CSS, JS, Images, etc. If your app is configured with the static files on a specific folder, you need to set this path, so that the web server directly serves these files.  

Setting the wrong path for static files may break the website's contents.

Change Project Mode

You can switch your project into production or development mode. This mode will be enabled on your web server configuration.

Enable / Disable Sandbox

This option will help you to enable or disable the virtual Python setup on your SandBox app. 

Disabling the sandbox may break your sandbox application if it has custom modules.

Re-Install Sandbox

This option will remove all installed modules on your SandBox and reinstall the app python virtual environment on your project.

Delete SandBox

This option will uninstall the SandBox from your selected domain.