Daniel
Daniel

Reputation: 1

Deploy a Django + SQL Server project using Apache

How can I deploy a Django project that uses SQL Server in Apache?

I created a project in Django and I want to put it in a Azure virtual machine and deploy it with apache, but I have some issues because SQL Server isn't supported for this framework, I have a database adapter like Django-Pyodbc, it works in my local but when I try to run it in a virtual machine than have Apache I get some errors, so what is the best way to do this?

Here is what the Apache error log shows:

mod_wsgi (pid=41732): Failed to exec Python script file '/var/www/html/Agroweb/agroweb/wsgi.py'. (pid=41732): Exception occurred processing WSGI script '/var/www/html/Agroweb/agroweb/wsgi.py'. Traceback (most recent call last): File "/var/www/html/Agroweb/agroweb/wsgi.py", line 12, in from django.core.wsgi import get_wsgi_application ImportError: No module named django.core.wsgi caught SIGTERM, shutting down Apache/2.4.41 (Ubuntu) mod_wsgi/4.6.8 Python/2.7 configured -- resuming normal operations Command line: '/usr/sbin/apache2'

Upvotes: 0

Views: 64

Answers (1)

Daniel
Daniel

Reputation: 1

I found the error: Apache wasn´t reading the python3 version so I installed the following package in my virtual environment:

libapache2-mod-wsgi-py3

This library helped me to read the python3 version instead of python2 and now my Django project is running in Apache.

Upvotes: 0

Related Questions