Jump to content


Photo

[Answered] Access to cpanel and Django initialisation

cPanel python django

  • This topic is locked This topic is locked
6 replies to this topic

#1 braux

braux

    Newbie

  • Members
  • 4 posts

Posted 17 November 2020 - 01:22 PM

Hello,

I am new to Heliohost and already have a few problems.

 

First of all, I can't access cPanel. When I login to https://www.heliohost.org/login/ and use the "continue to cPanel" button, I end up on a loading error page. Is it because it needs a really good internet connection ? If so, what should I do, as I cannot get a better one for now ?

 
Secondly, I would like to host a Django application. I tried to follow the wiki-tutorial (https://wiki.helione...utorials/django), but all I get is a "basic hosting" of the files, and the app itself is not launched: when I go to my web address (mywebname.heliohost.us), I only get a list of the files and directories (db.sqlite3, manage.py, ...). If I host regular files (like .html files), I can access/see them without any problem.

- Do you see what I could have missed when uploading my django app ?

- What is the difference between the tutorial I followed (https://wiki.helione...utorials/django) and this one http://www.heliohost...anguages/python ? In particular, the second one says something about python's eggs, and that is not mentioned at all in the first one, so ... which is the "good" one ?

 

 

Thanks in advance for any answer, hoping that my English is not too horrid ...



#2 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 21,470 posts
  • Gender:Male

Posted 18 November 2020 - 01:35 AM

First of all, I can't access cPanel. When I login to https://www.heliohost.org/login/ and use the "continue to cPanel" button, I end up on a loading error page.

It might be that you have port 2083 blocked. If port 2083 is blocked you still might be able to connect to cpanel using the insecure button at the bottom of the page, but then a hacker could intercept your data because it's not encrypted. We recommend finding a way to enable port 2083.

when I go to my web address (mywebname.heliohost.us), I only get a list of the files and directories (db.sqlite3, manage.py, ...)

It sounds like you forgot to create the .htaccess file.

#3 braux

braux

    Newbie

  • Members
  • 4 posts

Posted 18 November 2020 - 07:35 AM

Oh, perfect, you were right about the port ! Thanks for that.

 

 

I've got a .htaccess file, but I really am confused about it. My tree is like that :

home/
└─ username/
  └── public_html/
    ├── db.sqlite3
    ├── manage.py
    └── myproject/
      ├─.htaccess
      ├── dispatch.wsgi
      ├── __init__.py
      ├── __pycache__
      ├── settings.py
      ├── urls.py
      └── wsgi.py

 

My .htaccess :

RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(admin_media/.*)$ - [L]
RewriteRule ^(myproject/dispatch\.wsgi/.*)$ - [L]
RewriteRule ^(.*)$ myproject/dispatch.wsgi/$1 [QSA,PT,L]

As this configuration has no logic for me, I also tried to put the .htaccess file in /home/username/public_html/, but then I get a 500 error.

My Django app runs well in local.
 



#4 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 21,470 posts
  • Gender:Male

Posted 18 November 2020 - 09:15 PM

I don't even see a myproject directory on your account. Did you change the name or delete it?



#5 braux

braux

    Newbie

  • Members
  • 4 posts

Posted 19 November 2020 - 12:41 PM

Sorry, I simplified the tree to make the explanation clearer.

My project is named "visu_casu", and the other directories that already are on my account (mapApp, media, static) are sub-directories for this django project. Everything works well on a local server.

 

The contents of my directories are:

public_html:

db.sqlite3
manage.py
mapApp/
media/
static/
visu_casu/

 

visu_casu:

.htaccess
__init__.py
__pycache__/
asgi.py
dispatch.wsgi
settings.py
urls.py
wsgi.py
 

And for the files:

.htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(admin_media/.*)$ - [L]
RewriteRule ^(visu_casu/dispatch\.wsgi/.*)$ - [L]
RewriteRule ^(.*)$ visu_casu/dispatch.wsgi/$1 [QSA,PT,L]

dispatch.wsgi / wsgi.py

import os, sys

sys.path.append("/home/braux/public_html/visu_casu")

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'visu_casu.settings')

application = get_wsgi_application()


#6 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 21,470 posts
  • Gender:Male

Posted 20 November 2020 - 10:53 PM

I fiddled with it and made a few changes for you http://visucasu.heliohost.us/

 

The main problem I saw is it looked like you were half following a guide to make your webroot a django app, and you were half following a guide to make a django app in a subdirectory. I flipped a coin and went with the assumption that maybe you wanted it set up as your webroot. It also needed a module named folium installed, and about a dozen other small changes. Now it's throwing a file not found error which I suspect is because it's trying to access /media/shp/basin.geojson instead of /home/braux/public_html/media/shp/basin.geojson. You should be able to take it from here.



#7 braux

braux

    Newbie

  • Members
  • 4 posts

Posted 23 November 2020 - 10:36 AM

Ok, now I see what I did wrong. Thanks a lot, it is perfect !







Also tagged with one or more of these keywords: cPanel, python, django

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users