low level error

You see the sourcecode of the CGI/fastCGI dispatcher files

Apache handle the script as a text file, so you see the sourcecode in the browser.

There are several reasons for this:

  • The index.fcgi / index.cgi script is not executable. Do e.g.: chmod +x index.fcgi
  • Apache doesn't know to handle this file: Edit your .htaccess and uncomment the suitable AddHandler line
  • CGI execution are not allowed: Edit .htaccess and uncomment Options +ExecCGI

You get a 'Internal Server Error' or 'Premature end of script headers'

These low level Apache errors can have many causes:

  • Check: chmod, chown of the handler file (see above)
  • Check AddHandler, Options in .htaccess (see above)
  • Check shebang in handler file (e.g.: #!/usr/bin/env python or #!/usr/bin/python)
  • Check if mod_python is not used. (The default handlers used fastCGI or CGI and not mod_python)
  • You used a not allowed directive in .htaccess file (check apache log)

More tips:

You get the error: VIRTUALENV_FILE value is wrong: '/path/to/PyLucid_env/bin/activate_this.py'

You haven't change in index.fcgi / index.cgi the path to the created PyLucid environment. Please read the error page, there is the path to the file you must edit.

Error loading File [jquery.js]!

If you get this or a similar error:

  • The path to the static files (like "jquery.js" or "pylucid_js_tools.js" etc) is wrong
  • The Webserver didn't send the files
  • SERVE_STATIC_FILES != True (used with developer server)

These settings are responsible for the path generation:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Note: Every URL/path...
# ...must be a absolute path.
# ...must have a trailing slash.

# Absolute _local_filesystem_path_ to the directory that holds media.
#     Example-1: ".../static/" (default)
#     Example-2: "/home/foo/htdocs/static/"
MEDIA_ROOT = os.path.join(PYLUCID_BASE_PATH, "media") + "/"

# URL that handles the media served from MEDIA_ROOT.
#     Example-1: "/static/" (default)
#     Examlpe-2: "http://other_domain.net/static/"
#     Example-3: "http://media.your_domain.net/"
MEDIA_URL = "/static/"

# URL prefix for admin media -- CSS, JavaScript and images.
#     Examples-1: "/django/contrib/admin/static/" (default)
#     Examples-2: "http://other_domain.net/static/django/"
#     Examples-3: "http://django.media.your_domain.net/"
ADMIN_MEDIA_PREFIX = "/django/contrib/admin/static/"

Note: PYLUCID_BASE_PATH is the absolute path to PyLucid settings.py - You must change MEDIA_ROOT in your local_settings.py

MySQLdb not installed / install external modules

Please note:
New modules, installed in the normal python environment or installed via package management after PyLucid environment created, aren't accessible in the PyLucid environment!

To install a new external module into the environment, do this (e.g. install MySQLdb):

1
2
.../PyLucidTest$ cd PyLucid_env/bin
.../PyLucidTest/PyLucid_env/bin$ ./easy_install MySQL-python

PyLucid Login doesn't work

In some case the PyLucid own login view can't work. You can use the django own plaintext login form:

  • enable debug mode (set DEBUG=True in local_settings.py)
  • Add any GET parameter to the admin url, e.g: yoursite.tld/admin/?foobar

DoesNotExist: Site matching query does not exist. (settings.SITE_ID: 1)

If you get this error, this can have two causes:

  • The database is empty. You didn't load the initial data with e.g.: ./manage.sh loaddata pylucid.json
  • The site ID doesn't exist. You have to change the ID in your local_settings.py file or add the site in the Django admin site (Use a other, working domain/site). See: setup site

IndexError: list index out of range

Traceback looks like: http://dpaste.com/186070/
If you get this error, this can have two causes:

  • The database is empty. You must insert the initial data with ./manage.sh loaddata pylucid.json
  • There exist no languages. You have to create one.

warnings.warn("Version conflict:...

A python package is outdated. This can happen, if you update a package via GIT or SVN. In this case the python package meta information would not be updated.

You can update via pip. e.g. update django-tools:

1
2
3
~$ cd /PyLucid_env/bin
~/PyLucid_env/bin$ source activate
(PyLucid_env)~/PyLucid_env/bin$ pip install --upgrade --verbose --editable=svn+http://django-tools.googlecode.com/svn/trunk/#egg=django-tools

or use update script in /scripts/update_test_env.sh up upgrade all packages with pip.

ImproperlyConfigured: You haven't set the database ENGINE setting yet.

There is no database connection info in the used settings. This can happens in different situation.

  1. You didn't have a local_settings.py
  2. You didn't insert database connection info in your local_settings.py
  3. Your local_settings.py didn't used

To be sure whether your local_settings.py is being used do the following:

  1. check your directory and file structure:
    local_settings.py, manage.py and index.fcgi must be contained together, e.g. in: /var/www/YourSite/
  2. your current work dir should be /var/www/YourSite/
    (so manage.py from /var/www/YourSite/ would be used)

You can display your changed settings with diffsettings, e.g.:

1
/var/www/YourSite$ ./manage.py diffsettings

Please fill out settings.ADMINS!

You should set settings.ADMINS (and settings.MANAGERS), e.g. use the same people for both:

1
2
MANAGERS = (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
ADMINS = MANAGERS

see also: