Yousuf Jawwad
Yousuf Jawwad

Reputation: 3097

django on ubuntu

I have done everything said on the following page.

https://help.ubuntu.com/community/Django

but it gives me an error page.

MOD_PYTHON ERROR

ProcessId: 2220 Interpreter:
'localhost.localdomain'

ServerName:
'localhost.localdomain' DocumentRoot: '/etc/apache2/htdocs'

URI: '/' Location:
'/' Directory: None Filename:
'/etc/apache2/htdocs' PathInfo:
'/'

Phase: 'PythonHandler' Handler:
'django.core.handlers.modpython'

Traceback (most recent call last):

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent)

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1229, in _process_target result = _execute_target(config, req, object, arg)

File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1128, in _execute_target result = object(arg)

File "/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py", line 228, in handler return ModPythonHandler()(req)

File "/usr/lib/pymodules/python2.6/django/core/handlers/modpython.py", line 191, in call self.load_middleware()

File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 33, in load_middleware for middleware_path in settings.MIDDLEWARE_CLASSES:

File "/usr/lib/pymodules/python2.6/django/utils/functional.py", line 276, in getattr self._setup()

File "/usr/lib/pymodules/python2.6/django/conf/init.py", line 40, in _setup self._wrapped = Settings(settings_module)

File "/usr/lib/pymodules/python2.6/django/conf/init.py", line 75, in init raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))

ImportError: Could not import settings 'examples.settings' (Is it on sys.path? Does it have syntax errors?): No module named examples.settings

what could be wrong?

complete noob here.

Upvotes: 1

Views: 1357

Answers (1)

Ski
Ski

Reputation: 14487

If you are deploying django project for production under ubuntu server it is recommended to use WSGI. Just fallow the django documentation: https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/

Installing apache with wsgi under ubuntu is easy:

apt-get install libapache2-mod-wsgi

In case you just want to explore django you do not need to setup apache or anything. Just use manage.py runserver instead.

Upvotes: 3

Related Questions