Sunday, January 26, 2014

Problems Setting Up wsgi and Apache

I have my first django app running using runserver. I am now trying to get Apache to serve my site. I have read the django docs and quite a few other references on the Internet, but I cannot get Apache to do anything with my django site. And no error message.

I am running django 1.6 in a virtual environment with Python 2.7 on Debian Linux inside my LAN. 

Configuration file for apache
/etc/apache2/sites-enabled/mom.conf:
<VirtualHost *:7000>
    ServerName beagle
    ServerAlias beagle
    ServerAdmin mark@beagle
    
    DocumentRoot /var/www/mom

    WSGIScriptAlias /mom /home/django/django_projects/inventory/inventory_project/wsgi.py

    <Directory /home/django/django_projects/inventory/inventory_project>
        Order deny,allow
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/mom/error.log
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/mom/access.log combined
</VirtualHost>

/home/django/django_projects/inventory/inventory_project/wsgi.py
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "inventory_project.settings.dev")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

The project layout:
/home/django/django_projects/
└── inventory
    ├── fabfile2.py
    ├── fabfile.py
    ├── inventory
    │   ├── admin.py
    │   ├── admin.py~
    │   ├── admin.pyc
    │   ├── forms.py
    │   ├── __init__.py
    │   ├── __init__.pyc
    │   ├── migrations
    │   ├── models.py
    │   ├── models.py~
    │   ├── models.pyc
    │   ├── templates
    │   ├── templatetags
    │   ├── tests.py
    │   ├── urls.py
    │   ├── urls.py~
    │   ├── urls.pyc
    │   ├── views.py
    │   ├── views.py~
    │   └── views.pyc
    ├── inventory_project
    │   ├── __init__.py
    │   ├── __init__.pyc
    │   ├── media
    │   ├── settings
    │   ├── settings.py
    │   ├── settings.py~
    │   ├── settings.pyc
    │   ├── settings.py.old
    │   ├── static
    │   ├── urls.py
    │   ├── urls.py~
    │   ├── urls.pyc
    │   ├── wsgi.py
    │   └── wsgi.pyc
    ├── manage.py
    ├── mom
    ├── Notes.txt
    ├── README
    └── requirements.txt

/etc/apache2/mods-enabled/wsgi.conf
 WSGIPythonPath /home/django/django_projects/inventory:/home/django/.virtualenvs/inventory_project/lib/
python2.7/site-packages/

Any ideas on why I only get "Ooops cannot connect to beagle:7000/mom"?

Thanks,

Mark

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEqej2O1ZfrsbywQWW9XSK5iEkybkMd4B%2B9Rxdi0bQC_Zzc%2BNA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment