2

Have setup Django in virtualenv but get 500 Internal Server Error. Development server worked fine.

Environment:

  • Python 2.7.12
  • Apache 2.4.23
  • Django 1.10
  • Fedora 24

Server log:

[Mon Aug 29 12:27:49.364393 2016] [mime_magic:error] [pid 19158] [client 14.2.108.225:49222] AH01512: mod_mime_magic: can't read `/home/fedora/motorable/motorable/wsgi.py'
[Mon Aug 29 12:27:49.364552 2016] [mime_magic:error] [pid 19158] [client 14.2.108.225:49222] AH01512: mod_mime_magic: can't read `/home/fedora/motorable/motorable/wsgi.py'
[Mon Aug 29 12:27:49.364904 2016] [wsgi:error] [pid 19157] (13)Permission denied: [remote 14.2.108.225:1832] mod_wsgi (pid=19157, process='motorable', application='ip-172-31-22-170.ap-southeast-2.compute.internal|'): Call to fopen() failed for '/home/fedora/motorable/motorable/wsgi.py'.

Configuration:

Alias /static /home/fedora/motorable/static
<Directory /home/fedora/motorable/static>
    Require all granted
</Directory>

<Directory /home/fedora/motorable/motorable>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess motorable python-path=/home/fedora/motorable:/home/fedora/mot$
WSGIProcessGroup motorable
WSGIScriptAlias / /home/fedora/motorable/motorable/wsgi.py
WSGISocketPrefix /var/run/wsgi

WSGI is running in daemon mode, I tried adding the WSGISocketPrefix directive but I'm not sure what else to check or do. First time experimenting with Django here. The user home directory is 710 and should allowing Apache in, I added apache user to the primary group of fedora.

Can anyone share some insight?

7
  • 2
    check the permissions on wsgi.py. Commented Aug 29, 2016 at 13:03
  • Offtopic, but if First time experimenting with Django here you should know that you can also use uwsgi , here is about how to connect uWSGI + Django docs.djangoproject.com/en/1.10/howto/deployment/wsgi/uwsgi and here how Apache + uWSGI uwsgi-docs.readthedocs.io/en/latest/Apache.html Commented Aug 29, 2016 at 13:09
  • wsgi.py is set 664 but I did chown to the web server group and still nothing. @user3479125 I'm not sure if another interface module will address the underlying problem. Commented Aug 29, 2016 at 13:24
  • Not execute calling as file, rejected by apache ! Where exec defitions ? Commented Aug 29, 2016 at 13:36
  • 1
    Are you running SELinux? Is your home directory permissions such that others cannot read/search it? Commented Aug 29, 2016 at 20:45

2 Answers 2

1

Moving the project outside the home directory to /var/www/django solved my question.

Sign up to request clarification or add additional context in comments.

Comments

0

Disabling SELinux did the trick for me. on RHEL system, steps were as follows:

$ sudo yum install grubby
$ sudo grubby --update-kernel ALL --args selinux=0
$ sudo reboot

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.