Jump to content

Recommended Posts

Posted (edited)

Hello. For the last two hours, i've been trying to set up django, but without success. I keep getting a 500 Error, and can't figure out why. I've followed the tutorial on https://wiki.helionet.org/tutorials/django , and as it didn't work I tried using the cookiecutter template, but the result is the same. Could someone help me? Files content follow, adress is http://takame.heliohost.org/lifecounter/

 

.htaccess

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

 

dispatch.wsgi

import os, sys

# edit your username below
sys.path.append("/home/takame/public_html")

from django.core.wsgi import get_wsgi_application

os.environ['DJANGO_SETTINGS_MODULE'] = 'lifecounter.settings'

application = get_wsgi_application()

 

 

Edited by takame
Posted

Did you make the files on Windows? If so, you probably need to convert the line-endings to unix style (Notepad++ can produce/convert files to use unix line endings).

 

Python stuff does not like files with Windows/DOS line endings.

Posted (edited)

Did you make the files on Windows? If so, you probably need to convert the line-endings to unix style (Notepad++ can produce/convert files to use unix line endings).

 

Python stuff does not like files with Windows/DOS line endings.

I'll try this later, thanks

 

Edit : No changes

Edited by takame
Posted

Krydos is the one who really knows about Django. He'll probably be able to figure this out instantly, whereas I'd have to stumble through it (I'm a PHP guy).

 

Your line endings were still dos, and the sys.path.append in the dispatch.wsgi was pointed to the wrong place, but I fixed both of them and it still won't run. The error logs aren't very helpful, they just show it failing on line 10, which is the get_wsgi_application() call.

[Tue Mar 30 15:28:24.586816 2021] [wsgi:error] [pid 6430] [client 69.139.94.22:61532]   File "/home/takame/public_html/lifecounter/dispatch.wsgi", line 10, in <module>, referer: http://takame.heliohost.org/
[Tue Mar 30 15:28:24.583458 2021] [wsgi:error] [pid 6430] [client 69.139.94.22:61532] mod_wsgi (pid=6430): Exception occurred processing WSGI script '/home/takame/public_html/lifecounter/dispatch.wsgi'., referer: http://takame.heliohost.org/
[Tue Mar 30 15:28:24.583375 2021] [wsgi:error] [pid 6430] [client 69.139.94.22:61532] mod_wsgi (pid=6430): Failed to exec Python script file '/home/takame/public_html/lifecounter/dispatch.wsgi'., referer: http://takame.heliohost.org/
Posted

This one was actually my fault. The reason I'm the only one who can install python modules is because I need to pay attention and make sure there aren't conflicts. I apparently wasn't paying enough attention and there was a conflict that I missed. Now that the modules are fixed your django site works.

  • Like 1
Guest
This topic is now closed to further replies.
×
×
  • Create New...