Django Invalid command ‘SetEnv’ in OpenSUSE

Today I came upon a problem when I wanted to integrate a Django project into my Apache via mod_python on my OpenSUSE virtual server.

I put the snippet I need for Django into a separate config file called django.conf into the folder /etc/apache2/conf.d/ from which all files are automatically loaded whenever Apache starts.

Everytime I wanted to start my Apache it said
Syntax error on line 6 of /etc/apache2/conf.d/django.conf:
Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration

This seems to be a problem with the Apache configuration of OpenSUSE as mod_env which provides the SetEnv directive is installed but disabled.

Solution:

  1. Start yast (from the command line)
  2. Select “Network Services”
  3. Select “HTTP Server”
  4. Select “Server Modules”
  5. Select “Network Services”
  6. Scroll to “env”
  7. Select “Toggle Status”
  8. Select “Finish”

Done.

Posted in apache, django, opensuse, python Tagged with: apache, django, opensuse, python