python - client denied by server configuration -
i trying setup django project apache , mod_wsgi file. getting error client denied server configuration: /home/ghrix/production
. have google errro , found lot of solutions nothing worked me.
my code follows :
production.wsgi
import os import sys sys.path = ['/home/ghrix/myproject/'] + sys.path os.environ['django_settings_module'] = 'config.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.wsgihandler()
production.conf file :
<virtualhost *:80> wsgiscriptalias / /home/ghrix/production.wsgi servername firstweb.com serveralias firstweb.com alias /static/ /home/ghrix/myproject/static/ <directory /home/ghrix/myproject/ > options indexes followsymlinks wsgiprocessgroup production wsgiapplicationgroup %{global} require denied </directory> </virtualhost>
i solved problem making 2 changes : 1) require denied -> change -> require granted 2) if @ project created there wsgi.py
file in project directory (same dir settings placed default) , not have create seperate wsgi file have created initially. point wsgi.py in conf file inside apache2
wsgiscriptalias / /<path my-project wsgi.py file>
that's error resolved. still if getting 1 more error after settings module not find have edit wsgi file , add 2 lines of code :
import sys sys.path = ['<path project>'] + sys.path
that's project run smoothly now.
so complete wsgi , conf files :
wsgi.py file :
import os import sys sys.path = ['<path project>'] + sys.path os.environ.setdefault("django_settings_module", "conf.settings") django.core.wsgi import get_wsgi_application application = get_wsgi_application()
and conf file :
<virtualhost *:80> wsgiscriptalias / /<path project>/wsgi.py servername secondweb.com serveralias secondweb.com alias /static/ /<path project>/static/ <directory /<path project>/ > options indexes followsymlinks require granted </directory> </virtualhost>
Comments
Post a Comment