Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

342
Views
Publicar proyecto Django con gunicorn y NGINX

Estoy tratando de publicar mi proyecto Django con NGINX y gunicorn, pero gunicorn me niega el permiso.

Mis últimos pasos lo que hice.

 mkdir /home/sama/websites cd /home/sama/websites mkdir test_project cd test_project

crear Virtualenvirement para este proyecto virtualenv --python=/usr/bin/python3.8 venv

Entorno virtual activar source venv/bin/activate

Instalación de Gunicorn y Django

 pip3 install gunicorn pip3 install django

crear proyecto

 cd .. django-admin startproject config test_project

permitir el cortafuegos al puerto 8000 sudo ufw allow 8000

ejecute la primera prueba python manage.py runserver 0.0.0.0:8000

abra la IP de mi servidor en el navegador web myIP: 8000 Puedo ver la página básica de Django

detener el servidor CTRL + C

testGunicorn gunicorn --bind 0.0.0.0:8000 config.wsgi

testagain en webbrowser Nuevamente puedo ver la página de Djangos

Detención del servidor CTRL + C

salir del entorno virtual deactivate

config Gunicorn crea 2 archivos en /etc/systemd/system/

gunicorn.socket y gunicorn.servicio

edite estos archivos sudo nano /etc/systemd/system/gunicorn_test_project.socket

 /etc/systemd/system/gunicorn.socket [Unit] Description=gunicorn daemon [Socket] ListenStream=/run/gunicorn.sock [Install] WantedBy=sockets.target
 /etc/systemd/system/gunicorn.service [Unit] Description=gunicorn daemon Requires=gunicorn.socket After=network.target [Service] User=sama Group=www-data WorkingDirectory=/home/sama/websites/test_project ExecStart=/home/sama/websites/test_project/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/run/gunicorn.sock config.wsgi:application [Install] WantedBy=multi-user.target

toma de prueba

 sudo systemctl start gunicorn.socket sudo systemctl enable gunicorn.socket

systemlink creado, compruebe el file /run/gunicorn.sock Salida: /run/gunicorn.sock: socket

curl --unix-socket /run/gunicorn.sock localhost

Y ahora me niegan el permiso

Ya configuré el permiso para la carpeta test_project para el usuario sama y el grupo www-data, pero sin ningún efecto. ¿Lo que está mal?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

No veo una buena razón para usar la activación de socket systemd aquí.

Simplemente use un archivo de servicio y haga que Gunicorn se vincule a HTTP.

 [Unit] Description=gunicorn daemon After=network.target [Service] User=sama Group=www-data WorkingDirectory=/home/sama/websites/test_project ExecStart=/home/sama/websites/test_project/venv/bin/gunicorn --access-logfile - --workers 3 --bind 0.0.0.0:8000 config.wsgi:application [Install] WantedBy=multi-user.target
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!