2

I am trying to setup Django with Apache using mod_wsgi on Amazon's ec2 instance. I was following this guide for the setup. But after modifying the httpd.conf file and checking it with configtest,

/etc/init.d/httpd configtest

I get the following error:

'Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the server configuration' error.

The following are the lines from my httpd.conf file

WSGIScriptAlias / /home/ec2-user/frontend/backend-django/backend/wsgi.py
WSGIPythonHome /home/ec2-user/frontend/frontendenv
WSGIPythonPath /home/ec2-user/frontend/backend-django
WSGIDaemonProcess frontend  python-home=/home/ec2-user/frontend/frontendenv python-path=/home/ec2-user/frontend/backend-django
WSGIProcessGroup frontend

<Directory /home/ec2-user/frontend/backend-django/backend>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

When I looked up at SO, I've learnt that I have to either enable wsgi mod in apache or load the module in httpd.conf.

But I am getting

No package a2enmod available

and

httpd: Syntax error on line 159 of /etc/httpd/conf/httpd.conf: Cannot load modules/mod_wsgi.so into server: /etc/httpd/modules/mod_wsgi.so: cannot open shared object file: No such file or directory

errors respectively. The amazon's ec2 instance is running on Amazon Linux.

S B
  • 8,134
  • 10
  • 54
  • 108
  • This may not be useful to solving the issue at hand but I find that deploying Python applications with Apache is much more difficult than things have to be. I'd recommend Gunicorn and Nginx. – Callam Delaney May 26 '17 at 00:14

0 Answers0