Skip to main content

sample php app

Getting started with sample python app on Eenos

This guide will help you  to  create a sample python app  for Eenos hosting control panel.

The python apps are generic Django apps.  We recommend to read  the Django developer documentation to know how to create an app using Django.

Download an Example Python App

You can download an example Eenos Python App from  here sampleapp.tar.gz

app.conf

The first step is to create the app.conf . An example  for sampleapp is given below :

[settings]
# All the settings fields are mandatory 
# The Name of the parent folder of the app.
# The name may contain letters, digits, hyphen and underscore
# The name always starts with a letter and a length of 20 characters.
name = sampleapp

# The menu name that will be showing inside the control panel pages
#  Maximum menu name length is 24 characters.
menu = A Sample App

# A description about the app. What is the use of this app ?
# Maximum length of description is 6o characters. 
description = This is a sample python app for testing purpose

# The programming language , currently support python or php only
# If this is a Python Django app use python
# if this is a  PHP app chose , php
# Accepted values [ python , php]
language = python

# This app version number
version = 1.0.0

# The version_check_url is a remote url shows the available current version of the app
# This url must give the version number as plain text output
# This version should ensure if the app is up-to-date
version_check_url =  https://download.eenos.com/apps/sample-python-app/version.txt

# The auto update script path used to update the scripts
# You can place this in ,/scripts/ folder so that will be installed 
auto_update = /usr/local/eenos/scripts/sampleapp_update

[wap]
# The general settings for WAP admin app
# To enable or disable this app in admin panel 
# Supported values ,[ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values [ off,  on] , default off
open_new_window = off

[rapp]
# The general settings for RAPP - Reseller control panel app
# To enable or disable this app in reseller  panel 
# Supported values ,[ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values, [ off,  on] , default off
open_new_window = off

[uapp]
# The general settings for UAPP - User control panel app
# To enable or disable this app in user  panel 
# Supported values, [ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values [ off,  on] , default off
open_new_window = off

You should set the language with value python for a python app.

Files and destination of python app  - sampleapp

The following table will let you know where the files will be placed during app installation time.

Sample App Item Location to place Description
./hooks/* /var/eenos/hooks/  All hook scripts of the app
./scripts/* /usr/local/eenos/scripts/ All scripts of the app
./wap/sampleapp /usr/local/eenos/wap/sampleapp The admin panel plugin files
./rapp/sampleapp /usr/local/eenos/rapp/sampleapp The reseller panel plugin file
./uapp/sampleapp /usr/local/eenos/uapp/sampleapp The user panel app files
./static/sampleapp /usr/local/eenos/wap/public/static/default/sampleapp Admin panel static files
./static/sampleapp /usr/local/eenos/rapp/public/static/default/sampleapp Reseller panel static files
./static/sampleapp /usr/local/eenos/uapp/public/static/default/sampleapp User panel static file

The static files are common files  will be copied into the three control panel interface static folders.

 App folder structure 

An example folder structure of  pythonapp , sampleapp is as follows,

root@u: ~ # tree sampleapp
sampleapp
├── app.conf
├── hooks
│   └── createacct
│       ├── post
│       │   └── sampleapp_post.sh
│       └── pre
│           └── sampleapp_pre.sh
├── LICENSE
├── post
│   └── 02-post.sh
├── pre
│   └── 01-ps.sh
├── rapp
│   └── sampleapp
│       ├── admin.py
│       ├── apps.py
│       ├── __init__.py
│       ├── migrations
│       │   └── __init__.py
│       ├── models.py
│       ├── templates
│       │   └── sampleapp_index.html
│       ├── tests.py
│       ├── urls.py
│       └── views.py
├── README
├── requirements.txt
├── scripts
│   ├── sampleapp_scripts1
│   ├── sampleapp_scripts.py
│   └── sampleapp_scripts.sh
├── static
│   └── sampleapp
│       ├── sampleapp.js
│       └── style.css
├── uapp
│   └── sampleapp
│       ├── admin.py
│       ├── apps.py
│       ├── __init__.py
│       ├── migrations
│       │   └── __init__.py
│       ├── models.py
│       ├── templates
│       │   └── sampleapp_index.html
│       ├── tests.py
│       ├── urls.py
│       └── views.py
├── vhosts
│   ├── rapp.sampleapp.conf
│   ├── uapp.sampleapp.conf
│   └── wap.sampleapp.conf
└── wap
    └── sampleapp
        ├── admin.py
        ├── apps.py
        ├── __init__.py
        ├── migrations
        │   └── __init__.py
        ├── models.py
        ├── templates
        │   └── sampleapp_index.html
        ├── tests.py
        ├── urls.py
        └── views.py

Python requirements

You can place all your pip requirements for your python app inside the file  requirements.txt

Pre installation scripts

Put all your pre installation scripts of the plugin inside the folder pre/

Post installation scripts

Place all your post plugin installation scripts inside the folder post/

scripts

Place all scripts related with your plugin in the folder scripts/

hooks

Please all you hooks  for Eenos inside the folder hooks/

Packaging your app

To package an app create a gzipped tar file of the source folder . An example of sampleapp is as follows:

tar -czf sampleapp-1.0.0.tar.gz sampleapp/

Install , Remove and Upgrade App

To install , remove or upgrade app please read the app operations from Manage Apps  page.