I am having a lot of trouble figuring out what is wrong with my installation. This is my first time setting up a django app on a production server so I think I just need a little bit of help figuring out how to configure the path to the settings module. This is what I have in my httpd.conf file.
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName nodeline.com
WSGIScriptAlias / /home/mysite/mysite/wsgi.py
</VirtualHost>
I started a basic project in the /home directory called mysite using this command.
django-admin.py startproject mysite
This is what is coming out in the apache erro logs:
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] mod_wsgi (pid=26120): Exception occurred processing WSGI script '/home/mysite/mysite/wsgi.py'.
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] Traceback (most recent call last):
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 236, in __call__
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] self.load_middleware()
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 45, in load_middleware
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 53, in __getattr__
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] self._setup(name)
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 48, in _setup
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] self._wrapped = Settings(settings_module)
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 134, in __init__
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Sat Jul 06 02:49:42 2013] [error] [client 119.63.193.132] ImportError: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings
This is what is inside the /home/mysite/mysite/wsgi.py file (it is the default configuration that comes with the file when starting a project.):
"""
WSGI config for mysite project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "mysite.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
I really just need to get the standard screen to show up and I know I can move forward from there. I should also note that when I start up the app just using the django built in development server it works. I started it up on port 8000 using this command:
python manage.py runserver 0:8000
When visiting nodeline.com:8000 it works.