Jump to content

[Solved] Django Project Not Working


juanky

Recommended Posts

Hi all,

 

Now project dependencies seems to be satisfied, my Django website is not properly configured because it is not loaded when accesing to https://inforiesgo.heliohost.org/

 

File .htaccess seems to be correct, I have followed the steps described in the Django wiki.

 

I think the problem could be related to:

 

  1. Postgres: I created the postgres database and changed settings.py file in order to use this new database. Anyway, the creation of this database is just to create and asign it a superuser, not launching commands such as manage.py makemigrations or migrate, so the database should be empty.
    • settings.py database configuration looks like:

      'NAME': 'iniesta_inforiesgo', 'USER': 'iniesta_juanky', 'PASSWORD':*****, 'HOST':'127.0.0.1', 'PORT': '5432'

  2. static files: I made no changes related to the static files, so settings.py is the same than the one working in localhost:
  • STATIC_URL = '/static/'

 

Any help would be grateful.

Thanks!

Link to comment
Share on other sites

To troubleshoot missing modules I highly recommend making a simple helloworld cgi and adding each import one at a time until it throws a 500 error. You can also follow this guide https://www.helionet.org/index/topic/29544-python-27-module-request500-error-troulbeshooting/?p=133824 to use a cron to find your error, although that doesn't always work with django/flask because they are loaded through wsgi. Let us know what you find.

Link to comment
Share on other sites

To troubleshoot missing modules I highly recommend making a simple helloworld cgi and adding each import one at a time until it throws a 500 error. You can also follow this guide https://www.helionet.org/index/topic/29544-python-27-module-request500-error-troulbeshooting/?p=133824 to use a cron to find your error, although that doesn't always work with django/flask because they are loaded through wsgi. Let us know what you find.

 

Thanks!

 

I realized my project also has dependencies with modules json and datetime but these are supposed to be included in python distribution by default, so I don't think the problem is there. Anyway, this topic doesn't ask for python modules installation so maybe I didn't explain myself correctly.

 

My doubts are related to static files and/or postgres database configuration. Is there a guide or something explaining how to configure them properly on heliohost?

Edited by juanky
Link to comment
Share on other sites

postgres database configuration. Is there a guide or something explaining how to configure them properly on heliohost?

You create the username and password, and grant permissions at https://tommy.heliohost.org:2083/frontend/paper_lantern/psql/index.html Depending on what you create it will look something like this:

username = iniesta_user
database = iniesta_db
password = <whatever>
port     = 5432
host     = localhost

My doubts are related to static files

Take a look at http://wiki.helionet.org/Django The .htaccess file is where you define your static file directories that won't be processed through dispatch.wsgi

RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(admin_media/.*)$ - [L]
You can add as many directories as you want or change media and admin_media to whatever you want, but whatever you put in there will be served directly from apache to the browser without being processed through django.
  • Like 1
Link to comment
Share on other sites

 

 

You create the username and password, and grant permissions at https://tommy.heliohost.org:2083/frontend/paper_lantern/psql/index.html Depending on what you create it will look something like this:

username = iniesta_user
database = iniesta_db
password = <whatever>
port     = 5432
host     = localhost

My database configuration seems to be correct.

 

 

 

 

My doubts are related to static files

Take a look at http://wiki.helionet.org/Django The .htaccess file is where you define your static file directories that won't be processed through dispatch.wsgi

RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(admin_media/.*)$ - [L]
You can add as many directories as you want or change media and admin_media to whatever you want, but whatever you put in there will be served directly from apache to the browser without being processed through django.

 

my dispatch.wsgi file looks like this:

import os, sys

sys.path.append("/home/iniesta/public_html")

from django.core.wsgi import get_wsgi_application

os.environ["DJANGO_SETTINGS_MODULE"] = "inforiesgoserver.settings"

application = get_wsgi_application()

and .htaccess:

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

because the static files are in the app inforiesgo I created inside project inforiesgoserver.

 

This configuration has been set following the http://wiki.helionet.org/Django, but only the folder structure "Index of /" is shown when I access https://inforiesgo.heliohost.org/

 

I can't figure out what the problem is :(

Link to comment
Share on other sites

The guide is for creating a django website within a subdirectory. If you want your django site to be on the webroot you'll need to move everything down one directory. The other option is you could just set it up to redirect anyone who visits your webroot into the subdirectory.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...