Tuesday, June 28, 2016

Re: Deploying Django via wsgi

how did you do that? please assist

On Saturday, 19 March 2016 00:22:18 UTC+2, parall...@gmail.com wrote:
Thank you all for your replies. It turned out to be something simple. Since Django was installed in a virtualenv I needed to include the path to the Django libs in the wsgi paths. Done and site up.

Again thanks!



On Tuesday, March 15, 2016 at 5:00:10 AM UTC-7, parall...@gmail.com wrote:
Quite new, and trying to deploy first Django site. I keep getting 503 errors. Here are the particulars, any hints as to what I'm doing wrong would be much appreciated! All directories and files are group owned and writable by www-data. Ubuntu server, and Apache2.4 server where I have root access. The tutorial where I got the howto is located here:
https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04

Thank you!

File structure/location:

/home/user/kb_venv/project_name/
    __init__.py
    settings.py
    urls.py
    wsgi.py
    manage.py
    app_name


/home/user/kb_venv/project_name/project_name/
    apache/
        __init__.py
        override.py
        wsgi.py


override.py file contents:
from project_name.settings import
DEBUG = True
#ALLOWED_HOSTS = ['104.131.154.99'] (no domain name, I'm using IP to access the site)

wsgi.py file contents:
#wsgi.py
import os, sys
# Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
sys.path.append(project)

# Add the path to 3rd party django application and to django itself.
sys.path.append('/home/smlake/kb_venv')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project_name.apache.override'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Apache2.4 000-default file:

<VirtualHost *:80>

    WSGIScriptAlias / /home/smlake/kb_venv/project_name/apache/wsgi.py
    <Directory "/home/smlake/kb_venv/kittybungalow/kittybungalow/apache/">
          Require all granted
    </Directory>
    ServerAdmin parall...@gmail.com
    DocumentRoot /home/smlake/kb_venv/project_name/project_name

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>


Apache error log entry:
[Mon Mar 14 23:58:48.413099 2016] [authz_core:error] [pid 8034:tid 140480713053952] [client 54.188.195.80:57782] AH01630: client denied by server configuration: /home/user/kb_venv/project_name/




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/62362ac3-2fad-416a-ba71-d895141fc4cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment