Using WSGI with python 3.5

1

Good afternoon I need help to get an application running with django 1.8 and python 3.5 on an ubuntu server

(Edit :) They are installed libapache2-mod-wsgi-py3 and enabled the a2enmod wsgi

The code is located at:

/var/www/html/ripso2/codigo (for reasons agenos to me the folder of the average files is: /var/www/html/ripso2/media )

The directory structure is as follows:

├── agenda
│   └── templates
├── capacitaciones
│   └── templates
├── configuracion
│   └── templates
├── consultas
│   ├── templates
│   │   ├── agenda
│   │   ├── capacitaciones
│   │   ├── epp
│   │   ├── gestion_riesgos
│   │   ├── mantenimiento_equipos
│   │   ├── novedades
│   │   └── rh
│   └── views
├── copasst
│   └── templates
├── cronograma
│   └── templates
├── __datos_iniciales__
│   ├── csv
│   ├── json
│   └── sql
├── epp
│   └── templates
├── estadisticas
│   ├── templates
│   └── views
├── general
│   └── templates
├── gestion_riesgo
│   └── templates
├── gestion_salud
│   ├── templates
│   └── views
├── gestion_usuarios
│   └── templates
├── indicadores
│   ├── templates
│   └── views
├── mantenimiento_equipo
│   └── templates
├── matriz_legal
│   └── templates
├── novedades
│   └── templates
├── phva
│   ├── templates
│   │   ├── actuar
│   │   ├── hacer
│   │   ├── planear
│   │   └── verificar
│   └── views
├── recurso_humano
│   ├── templates
│   └── views
├── ripso
    └── settings.py
    └── urls.py
    └── **wsgi.py**
├── seguimiento_cliente
│   └── templates
├── static
│   ├── ...
└── templates
    ├── menus
    └── publico
└── .gitignore
└── Readme.md
└── **django.wsgi**
└── manage.py
└── requirements.txt

The wsgi.py file is as follows:

import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ripso.settings")
application = get_wsgi_application()

The django.wsgi file is as follows:

import os, sys
sys.path.append('/var/www/html/ripso2/codigo')
os.environ['DJANGO_SETTINGS_MODULE'] = 'ripso.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

The virtualhost in etc / apache2 / sites-available is:

<VirtualHost midominio:80>
        ServerName pruebasoftware.midominio
        ServerAdmin [email protected]
        DocumentRoot /var/www/html/ripso2/codigo

        #WSGIScriptAlias / /var/www/html/ripso2/codigo/django.wsgi
        Alias /static/ /var/www/html/ripso2/codigo/static/

        <Directory /var/www/html/ripso2/codigo>
           Order allow,deny
           Allow from all
        </Directory>

        <Directory /var/www/html/ripso2/codigo/static>
           Order allow,deny
           Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/pruebasoftware.midominio-error.log
        CustomLog ${APACHE_LOG_DIR}/pruebasoftware.midominio-access.log co$

</VirtualHost>

My current situation is that at the moment only one directory structure is displayed (so I have not included the WSGI), however I verified (and it is ok) the connection with the database and pgadmin.

I have followed guides but I think I have not followed the correct one because with these it does not even let me restart Apache. Please help me to be able to run my application.

    
asked by Diana Carolina Hernandez 16.01.2017 в 21:13
source

1 answer

1

I have a server running with a virtual environment created for that project and in the apache configuration something like this:

WSGIDaemonProcess nombre_proceso python-path=/var/www/carpeta_projecto:/var/www/carpeta_proyecto/venv/lib/python3.4/site-packages
WSGIProcessGroup nombre_proceso
WSGIScriptAlias / /ruta_hasta_e_wsgi.py/wsgi.py

Between the link of the official documentation and another one that I found in google, I hope you get enough information.

link

link

    
answered by 17.01.2017 в 16:03