How to use Django with Apache and mod_wsgi

70 views
Skip to first unread message

Seyfullah Tıkıç

unread,
Aug 19, 2012, 5:30:51 PM8/19/12
to django...@googlegroups.com
Hello,
 
I read the article below.
 
But still http://localhost redirects to /var/www/localhost/htdocs/index.html.
I want http://localhost/ redirescts to /home/seyfullah/django/mysite.
How can I do this?

--
SEYFULLAH TIKIÇ

Joseph Mutumi

unread,
Aug 19, 2012, 5:55:00 PM8/19/12
to django...@googlegroups.com
Hello,

Could you post the VirtualHost configuration for Apache?
That would greatly help us help you.

Regards

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Seyfullah Tıkıç

unread,
Aug 20, 2012, 5:30:49 AM8/20/12
to django...@googlegroups.com
httpd.conf file is in the attachment.

2012/8/20, Joseph Mutumi <jjmu...@gmail.com>:
--
SEYFULLAH TIKIÇ
httpd.conf

Joris

unread,
Aug 20, 2012, 7:39:29 AM8/20/12
to django...@googlegroups.com
The DocumentRoot directive is missing from the httpd.conf, indicating you did not send all the required data. This may be because your attachment is incomplete:

There is an include statement in your httpd.conf: "Include /etc/apache2/conf.d/*.conf"
All files from that conf.d folder are also processed. Please look in files located in  /etc/apache2/conf.d/ for anything useful. Especially files that contain a documentroot directive

Also, it may help if you post the output of
apachectl -S 
(note: some distros want apache2ctl instead of apachectl)

jb

Joseph Mutumi

unread,
Aug 20, 2012, 8:26:42 AM8/20/12
to django...@googlegroups.com
You would be good to organize your configuration. Try creating a file under /etc/apache2/vhosts.d/
Probably my_domain.com (substitute my_domain.com with your actual domain).

And move all the configuration to it:
<VirtualHost *:80>
    ServerAdmin webmaster@my_domain.com
    DocumentRoot /usr/local/django/mysite/media/
    ServerName my_domain.com
    ServerAlias www.my_domain.com
   
    #WSGIDaemonProcess site-1 user=user-1 group=user-1 threads=25
    #WSGIProcessGroup site-1

    Alias /media/ /usr/local/django/mysite/media/

    <Directory /home/seyfullah/django/mysite/media>
        Order deny,allow
        Allow from all
    </Directory>

    WSGIScriptAlias / /home/seyfullah/django/mysite/apache/django.wsgi

    <Directory /home/seyfullah/django/mysite/apache>
        Order deny,allow
        Allow from all
    </Directory>
   
</VirtualHost>

You can remove the comments after you are sure its working

Regards

To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/KkXJTQwbtYwJ.

Seyfullah Tıkıç

unread,
Aug 22, 2012, 4:53:16 PM8/22/12
to django...@googlegroups.com
I checked my file again, it is not incomplete.

There is no file in /etc/apache2/conf.d

Output of apachectl -S is as below. I actually uninstalled mod_python, I want to use mod_wsgi only.
Syntax error on line 49 of /etc/apache2/modules.d/16_mod_python.conf:
Invalid command 'PythonHandler', perhaps misspelled or defined by a module not included in the server configuration

line 49 of /etc/apache2/modules.d/16_mod_python.conf is as below, I don't know why it causes an error.

    PythonHandler django.core.handlers.modpython


2012/8/20 Joris <joris.b...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/KkXJTQwbtYwJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
SEYFULLAH TIKIÇ

Seyfullah Tıkıç

unread,
Aug 22, 2012, 5:05:03 PM8/22/12
to django...@googlegroups.com
Then do I have to delete 00_default_vhost.conf file?
What name can I give to this new created file?

2012/8/20 Joseph Mutumi <jjmu...@gmail.com>



--
SEYFULLAH TIKIÇ

Joris

unread,
Aug 23, 2012, 3:24:26 AM8/23/12
to django...@googlegroups.com


Op woensdag 22 augustus 2012 23:05:03 UTC+2 schreef stikic het volgende:
Then do I have to delete 00_default_vhost.conf file?
What name can I give to this new created file?

Well you have not referred or included 00_default_vhost.conf in your httpd.conf so this file is not actually read by the web server! This is confirmed in your output of apache2ctl -S.
Together with the observation that there is no "NameVirtualHost" OR a "DocumentRoot"  directive in the httpd.conf you supplied, suggests you either are not supplying us with all the config info you have OR you have a really weird apache set up. Anyway, your issue is clearly with Apache and not Django, so it  may be better if you ask these questions in a dedicated forum.

jb

Reply all
Reply to author
Forward
0 new messages