django-thwterm 2.0.6

Creator: codyrutscher

Last updated:

Add to Cart

Description:

djangothwterm 2.0.6

thwterm is a simple web shell to connect to thhpc cluster through web
thwterm used in iframe in django template
detail documentation is in the “docs” directory
Quick start


pip install django-thwterm
Add “thwterm” to your INSTALLED_APPS setting like this:
INSTALL_APPS = [
...
'thwterm',
]

Include the thwterm URLconf in your project urls.py like this:
from thwterm import urls as thWTermUrls
urlpatterns = [...] + thWTermUrls.urlpatterns,


Set IFrame Option in settings.py like this:
X_FRAME_OPTIONS = ‘ALLOWALL’



Add the thwterm in your html tempalte by iframe like this:


1)、add path in project urls like this:
path(‘xterm/’, main.xTerm),

2)、in main views.py:
@login_required

def xTerm(request):
return render(request,”xterm.html”,{})

3)、write the xterm.html tempalte file like:


<div class=”page-row”>

<iframe id=”webterminaliframe” src=”/thwterm/” frameborder=”0” width=”100%” height=”100vh” style=”height: 80vh” scrolling=”no”></iframe>
</div>








Setup thuri appid and appid in settings.py like this;
TH_WEBTERM_CONFIG = {
‘WTERM_BACKEND_HOST’:’{ visual<shell> backend server }’,
‘WTERM_BACKEND_APPID’:’{appid}’,
‘WTERM_BACKEND_APPKEY’:’{appkey}’}




Add th user and cluster to session when user login like this:
request.session[“systemUsername”] = “{thsystem user name}”
request.session[“cluster] = “thcluster1”




Use nginx proxy the porject port like this:

server {
listen 80;
server_name _;

port_in_redirect off;


location /visual/ {
proxy_pass { visualbackend server }
proxy_http_version 1.1;
proxy_read_timeout 600s;
proxy_redirect off;
proxy_set_header Upgrade httpupgrade;proxysetheaderConnection“upgrade”;proxysetheaderHosthost:serverport;proxysetheaderX−Real−IPremote_addr;
proxy_set_header REMOTE-HOST remoteaddr;proxysetheaderX−Forwarded−Forproxy_add_x_forwarded_for;


}

location / {
proxy_set_header Host host;proxysetheaderX−real−ipremote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass { django server:port };


}





Start the development server and visit http://yourhost:port/xterm/ you will see the web term

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.