Permissions error when wanting to upload documents in django using apache in redhat

3

When wanting to publish my website on a redhat server with apache, I can not write data on the bd, I followed this tutorial:

link

I already tried giving it permissions with chmod 755 db.sqlite3, I also tried as owner of the directory and documents to apache, and I restarted the services with the systemctl restart httpd and systemctl enable httpd

I was able to create a superuser with python manage.py, but when I wanted to enter the admin, I got the error that I do not have writing permission.

My wsgi.py

import os
import sys

from django.core.wsgi import get_wsgi_application

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

application = get_wsgi_application()

My django.conf

AddDefaultCharset utf-8

Alias /static /opt/djangoproject/Convocatoria/static_cdn
Alias /media /opt/djangoproject/Convocatoria/MEDIA
Alias /favicon.ico /opt/djangoproject/Convocatoria/static_cdn/Icono.png

<Directory /opt/djangoproject/Convocatoria/static_cdn>
  Require all granted
</Directory>

  <Directory /opt/djangoproject/Convocatoria/MEDIA>
  Require all granted
</Directory>

<Directory /opt/djangoproject/Convocatoria/Un_Formulario/project>
   <Files wsgi.py>
       Require all granted
   </Files>
</Directory>

WSGIDaemonProcess Convocatoria python-path=/opt/djangoproject:/opt/djangoproject/djangoprojectenv/lib/python2.7/site-packages
WSGIProcessGroup Convocatoria
WSGIScriptAlias / 
/opt/djangoproject/Convocatoria/Un_Formulario/project/wsgi.py
    
asked by Kuroi 08.04.2018 в 12:59
source

1 answer

1

I solved it by disabling SELinux / etc / selinux / config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.
SELINUXTYPE=targeted
    
answered by 11.04.2018 / 16:01
source