ljrh
ljrh

Reputation: 449

Serving django app with apache2+mod_wsgi

I have configured a linode server with apache2 and mod_wsgi..

  1. the server is running
  2. wsgi is running
  3. postgre is running and syncdb was successful

what I am having trouble finishing is actually serving the app..

my file structure:

.
├── logfile
└── srv
    ├── logfile
    └── www
        └── quickerhub.com
            ├── admin
            │   ├── css
            │   │   ├── base.css
            │   │   ├── changelists.css
            │   │   ├── dashboard.css
            │   │   ├── forms.css
            │   │   ├── ie.css
            │   │   ├── login.css
            │   │   ├── rtl.css
            │   │   └── widgets.css
            │   ├── img
            │   │   ├── changelist-bg.gif
            │   │   ├── changelist-bg_rtl.gif
            │   │   ├── chooser-bg.gif
            │   │   ├── chooser_stacked-bg.gif
            │   │   ├── default-bg.gif
            │   │   ├── default-bg-reverse.gif
            │   │   ├── deleted-overlay.gif
            │   │   ├── gis
            │   │   │   ├── move_vertex_off.png
            │   │   │   └── move_vertex_on.png
            │   │   ├── icon_addlink.gif
            │   │   ├── icon_alert.gif
            │   │   ├── icon_calendar.gif
            │   │   ├── icon_changelink.gif
            │   │   ├── icon_clock.gif
            │   │   ├── icon_deletelink.gif
            │   │   ├── icon_error.gif
            │   │   ├── icon-no.gif
            │   │   ├── icon_searchbox.png
            │   │   ├── icon_success.gif
            │   │   ├── icon-unknown.gif
            │   │   ├── icon-yes.gif
            │   │   ├── inline-delete-8bit.png
            │   │   ├── inline-delete.png
            │   │   ├── inline-restore-8bit.png
            │   │   ├── inline-restore.png
            │   │   ├── inline-splitter-bg.gif
            │   │   ├── nav-bg.gif
            │   │   ├── nav-bg-grabber.gif
            │   │   ├── nav-bg-reverse.gif
            │   │   ├── nav-bg-selected.gif
            │   │   ├── selector-icons.gif
            │   │   ├── selector-search.gif
            │   │   ├── sorting-icons.gif
            │   │   ├── tool-left.gif
            │   │   ├── tool-left_over.gif
            │   │   ├── tool-right.gif
            │   │   ├── tool-right_over.gif
            │   │   ├── tooltag-add.gif
            │   │   ├── tooltag-add_over.gif
            │   │   ├── tooltag-arrowright.gif
            │   │   └── tooltag-arrowright_over.gif
            │   └── js
            │       ├── actions.js
            │       ├── actions.min.js
            │       ├── admin
            │       │   ├── DateTimeShortcuts.js
            │       │   ├── ordering.js
            │       │   └── RelatedObjectLookups.js
            │       ├── calendar.js
            │       ├── collapse.js
            │       ├── collapse.min.js
            │       ├── core.js
            │       ├── getElementsBySelector.js
            │       ├── inlines.js
            │       ├── inlines.min.js
            │       ├── jquery.init.js
            │       ├── jquery.js
            │       ├── jquery.min.js
            │       ├── LICENSE-JQUERY.txt
            │       ├── prepopulate.js
            │       ├── prepopulate.min.js
            │       ├── SelectBox.js
            │       ├── SelectFilter2.js
            │       ├── timeparse.js
            │       └── urlify.js
            ├── interest
            │   ├── django.wsgi
            │   ├── __init__.py
            │   ├── __init__.pyc
            │   ├── settings.py
            │   ├── settings.pyc
            │   ├── urls.py
            │   └── wsgi.py
            ├── js
            │   └── jquery-1.10.1.min.js
            ├── logfile
            ├── manage.py
            ├── README
            ├── reoccurring
            │   ├── admin.py
            │   ├── forms.py
            │   ├── __init__.py
            │   ├── __init__.pyc
            │   ├── models.py
            │   ├── models.pyc
            │   ├── usagelib.py
            │   └── views.py
            ├── schedule
            │   ├── admin.py
            │   ├── __init__.py
            │   ├── __init__.pyc
            │   ├── models.py
            │   ├── models.pyc
            │   ├── tests.py
            │   ├── usagelib.py
            │   └── views.py
            ├── src
            │   ├── facebooksdk
            │   │   ├── examples
            │   │   │   ├── appengine
            │   │   │   │   ├── app.yaml
            │   │   │   │   ├── example.html
            │   │   │   │   └── example.py
            │   │   │   ├── newsfeed
            │   │   │   │   ├── app.yaml
            │   │   │   │   ├── facebookclient.py
            │   │   │   │   ├── static
            │   │   │   │   │   ├── base.css
            │   │   │   │   │   ├── favicon.ico
            │   │   │   │   │   └── robots.txt
            │   │   │   │   └── templates
            │   │   │   │       ├── base.html
            │   │   │   │       ├── home.html
            │   │   │   │       └── index.html
            │   │   │   ├── oauth
            │   │   │   │   ├── app.yaml
            │   │   │   │   ├── facebookoauth.py
            │   │   │   │   └── oauth.html
            │   │   │   └── tornado
            │   │   │       ├── example.html
            │   │   │       ├── example.py
            │   │   │       └── schema.sql
            │   │   ├── facebook.py
            │   │   ├── facebook_sdk.egg-info
            │   │   │   ├── dependency_links.txt
            │   │   │   ├── PKG-INFO
            │   │   │   ├── SOURCES.txt
            │   │   │   └── top_level.txt
            │   │   ├── MANIFEST.in
            │   │   ├── README.rst
            │   │   └── setup.py
            │   └── pip-delete-this-directory.txt
            ├── static
            │   └── js
            │       └── jquery-1.10.1.min.js
            ├── templates
            │   ├── 404.html
            │   ├── 500.html
            │   ├── Base.html
            │   ├── Home.html
            │   ├── Reoccurring.html
            │   └── Usersettings.html
            └── usersetting
                ├── admin.py
                ├── __init__.py
                ├── __init__.pyc
                ├── models.py
                ├── models.pyc
                └── views.py

my django.wsgi:

import os
import sys

sys.path.append('/srv/www/quickerhub.com/')

os.environ['PYTHON_EGG_CACHE'] = '/srv/www/quickerhub.com.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

my httpd.conf:

my sites-enabled/quickerhub.com:

WSGIPythonPath /srv/www/quickerhub.com
<VirtualHost *:80>
    ServerName quickerhub.com

    Alias /static/ /srv/www/quickerhub.com/interest/static/
    WSGIScriptAlias / /srv/www/quickerhub.com/interest/django.wsgi

    <Directory />
        AllowOverride None
        Options -Indexes
    </Directory>


</VirtualHost>

I feel like everything is pointing to the correct stuff...

EDIT:

Now just getting a 404 file not found

Please help! Thanks!

Upvotes: 0

Views: 216

Answers (2)

Chris Hawkes
Chris Hawkes

Reputation: 12410

I just setup my site www.noobniche.com on Linode using WSGI. Unfortunately I'm not at home to compare my setup, if you're still having problems tonight I can look into it. From memory in my case, I had to enable by adding to sites-enabled and sites-available.

the structure should look something similar to this;

webapps(root directory)
    nichesite
        static
        django_project_name
            --> myproject.wsgi
            --> settings.py
            --> urls.py
            --> views.py
        manage.py

it seems your .wsgi file is located in your root directory, when it should be located within your django project folder.

Upvotes: 1

Daniel Roseman
Daniel Roseman

Reputation: 599450

So it looks as if you have conflicting settings for WSGIScriptAlias - one in httpd.conf, pointing to the right path for your wsgi file, and one in your sites-enabled file, pointing to the wrong path (/var/ instead of /srv/).

You should remove the one in httpd.conf and move it to sites-enabled/quickerhub.com so that the version there is correctly pointing to /srv/.

Upvotes: 0

Related Questions