ddiipp
ddiipp

Reputation: 205

How to configure apache2 for django wsgi?

i was trying to run my django application using apache2 and i failed. Its giving me a 500 internal server error saying The server encountered an internal error or misconfiguration and was unable to complete your request. First i created a firstweb.wsgi file in my home directory. And put this codes

import os
import sys
sys.path = ['/var/www/firstweb'] + sys.path
os.environ['DJANGO_SETTINGS_MODELE'] = 'firstweb.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

And in my /etc/apache2/sites-available i created a file named firstweb.conf In firstweb.conf i have this code

<VirtualHost *:80>
WSGIScriptAlias / /home/nihan/firstweb.wsgi

ServerName firstweb.com
Alias /static /var/www/firstweb/static

<Directory /var/www/firstweb/ >
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

And in my /var/www/ i created a django project by typing

sudo django-admin.py startproject firstweb

This is the first time i am trying apache , mod_wsgi and Django

Please help me to understand i have i missed

Upvotes: 0

Views: 889

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58563

The user that Apache runs as generally doesn't have access to stuff in your home directory. That this is the case cannot be confirmed as you haven't supplied the error message from the Apache error log, only what was displayed in the browser. Suggest you watch:

That talk covers common errors like that.

Upvotes: 1

Related Questions