Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

136
Vistas
Deploying Django restfule service using WAMP and mod_wsgi

I am trying to deploy an API built on Django rest-framework using mod_wsgi and WAMP. When I created a new Django project using 'django-admin startproject Predictor' and deployed it on WAMP, it was working fine as I can see the default Django window.

Now I created an app in the project using 'python manage.py startapp Predictor' I built an API which accepts GET call and tested it using 'python manage.py runserver' and it was working fine. Now I started WAMP service again and try to go to 'localhost:8000' it keeps loading. And as soon as I stop WAMP service it crashes saying Unable to connect. Not sure what's happening. Can someone help what's wrong I am doing? FYI I am on windows and I have created and virtual environment for my Django project. This is how my .conf and wsgi files look like

wsgi_windows.py

activate_this = 'C:/Users/DELL/Envs/predenv/Scripts/activate_this.py'
# execfile(activate_this, dict(__file__=activate_this))
exec(open(activate_this).read(),dict(__file__=activate_this))

import os
import sys
import site

# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('C:/Users/DELL/Envs/predenv/Lib/site-packages')

# Add the app's directory to the PYTHONPATH
sys.path.append('C:/Users/DELL/Envs/predenv')
sys.path.append('C:/Users/DELL/Envs/predenv/Predictor')

os.environ['DJANGO_SETTINGS_MODULE'] = 'Predictor.settings'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Predictor.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

httpd.conf

Listen localhost:8000
Listen [::0]:80
ServerName localhost:8000

LoadFile "c:/python376/python37.dll"
LoadModule wsgi_module "c:/python376/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd"
WSGIPythonHome "c:/python376"
WSGIPythonPath "C:/Users/DELL/Envs/predenv/Predictor"

httpd-vhosts.conf

WSGIPythonPath "C:/Users/DELL/Envs/predenv/Predictor"
<VirtualHost *:80>
    WSGIPassAuthorization On
    ErrorLog "logs/predictor.error.log"
    CustomLog "logs/predictor.access.log" combined
    DocumentRoot "C:/Users/DELL/Envs/predenv/Predictor"
    WSGIScriptAlias /  "C:\Users\DELL\Envs\predenv\Predictor\Predictor\wsgi_windows.py"
    <Directory "C:\Users\DELL\Envs\predenv\Predictor\Predictor">
        <Files wsgi_windows.py>
            Require all granted
        </Files>
    </Directory>
</VirtualHost>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The issue was it was not able to 'import pandas' in my views.py

To resolve this I have to add this line in my apache 'httpd-vhosts.conf' file

WSGIApplicationGroup %{GLOBAL}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda