Jump to content

leogama

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by leogama

  1. You're right, @logdog. The tutorial is contradictory in this regard. This minimal setup worked for me (other files are not required): $ tree public_html public_html ├── django_test │ ├── __init__.py │ ├── dispatch.wsgi │ ├── settings.py │ ├── urls.py │ ├── views.py │ └── wsgi.py -> dispatch.wsgi └── .htaccess Files' content (__init__.py is empty): .htaccess RewriteEngine On RewriteBase / RewriteRule ^(media/.*)$ - [L] RewriteRule ^(django_test/dispatch\.wsgi/.*)$ - [L] RewriteRule ^(.*)$ django_test/dispatch.wsgi/$1 [QSA,PT,L] dispatch.wsgi import os, sys # Change "username_on_heliohost" to the actual username sys.path.append('/home/username_on_heliohost/public_html') # More portable version #from pathlib import Path #sys.path.append(str(Path(__file__).parent.parent)) from django.core.wsgi import get_wsgi_application os.environ['DJANGO_SETTINGS_MODULE'] = 'django_test.settings' application = get_wsgi_application() settings.py SECRET_KEY = 'CHANGE THIS!' ALLOWED_HOSTS = ['*'] ROOT_URLCONF = 'django_test.urls' urls.py from django.urls import path from . import views urlpatterns = [ path('', views.index), ] views.py from django.http import HttpResponse def index(request): return HttpResponse("Hello, World!") Hope it helps
  2. I've struggled a little bit to set up Django, as I comment here (https://www.helionet.org/index/topic/38768-django-500-error/?do=findComment&comment=171385), but achieved it in the and. Thanks for the quick response.
  3. I had some troubles setting up Django yesterday, even after following this tutorial step-by-step. It turned out that there's an error in one of the code snippets. In the example dispatch.wsgi file, where it shows: # edit your username below sys.path.append("/home/username_on_heliohost/public_html") should be: # edit your username below sys.path.append("/home/username_on_heliohost/public_html/hello") which is the Django project root directory. Otherwise, you'll get a 500 Internal Server Error response because Python can't find the application module (that is at "/home/username_on_heliohost/public_html/hello/hello"). Would you change the Django application to the website's root in the future, you should update this line accordingly and also move the .htaccess file to the root (without changes).
  4. Hello! May I have django-wiki on Johnny (Python 3.7)? Thank you very much for the nice work
×
×
  • Create New...