1

I'm trying to run django on apache2 using mod_wsgi, but when I'm trying to connect "locatoka.ru" I get "Forbidden You don't have permission to access / on this server."

My actions: I added to httpd.conf

LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so

changed httpd.conf

WSGIScriptAlias /  /Users/Loginov/Desktop/project/project/wsgi.py

<VirtualHost locatoka.ru:80>

ServerName locatoka.ru
ServerAlias www.locatoka.ru

DocumentRoot "/Users/Loginov/Desktop/project"
<Directory /Users/Loginov/Desktop/project/project>
<Files wsgi.py>
    Order deny,allow
    Require all granted
</Files>
</Directory>


</VirtualHost>

wsgi.py

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

application = get_wsgi_application()

I'm using Mac OS X El Capitan and Python3.

Cœur
  • 37,241
  • 25
  • 195
  • 267
LOGA
  • 51
  • 1
  • 6
  • 2
    You should put the WSGIScriptAlias inside the VirtualHost section. – Daniel Roseman Nov 30 '16 at 18:13
  • 1
    But also note there's no need to use Apache to run your project on your laptop in development; use the built-in dev server. – Daniel Roseman Nov 30 '16 at 18:18
  • 1
    Also, are you sure locatoka.ru resolves to your Mac? – Mad Wombat Nov 30 '16 at 19:07
  • For a start, change ```` to ````. What you have will not work. – Graham Dumpleton Nov 30 '16 at 22:35
  • You will have other problems as you aren't setting up the Python module search path so that mod_wsgi will know where you project is. Make sure you review the Django documentation on how to use mod_wsgi at https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/modwsgi/ Some aspects of that doc are out of date though around use of Python virtual environments, so ensure you also read http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html – Graham Dumpleton Nov 30 '16 at 22:37
  • Finally, using mod_wsgi development is perfectly fine, although if you are doing that, is suggested you avoid configuring Apache yourself and use mod_wsgi-express instead. See https://pypi.python.org/pypi/mod_wsgi – Graham Dumpleton Nov 30 '16 at 22:38
  • And whatever you do, don't use mod_wsgi 3.2. That is way way out of date. – Graham Dumpleton Nov 30 '16 at 22:39

0 Answers0