0

I m trying to Deploy my django application on apache server (Xampp)

Present Versions :-

Python 3.7.3
Xampp :- 3.2.4
Apache :- 2.4
windows 10

Note:- i am using virtual environment

Was searching how to do that and encountered this Tutorial

However, After making the changes which are same as django Documentation. my apache server is not running

Its throwing the error

Error: Apache shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a crash, or a shutdown by another method. Press the Logs button to view error logs and check the Windows Event Viewer for more clues If you need more help, copy and post this entire log window on the forums

i did changed my port in httpd.conf to some other which was not used by another application, I am not able to figure out what is the issue.

Added to httpd.conf

LoadModule wsgi_module "c:/users/xxxx/appdata/local/programs/python/python37-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win32.pyd"
WSGIScriptAlias / "K:/Work/DevNet/first_project/first_project/wsgi.py"
WSGIPythonHome "C:/Users/xxxx/AppData/Local/Programs/Python/Python37-32"
WSGIPythonPath "K:/Work/Net/first_project"


<Directory "K:/Work/Net/first_project">
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

Also in httpd.conf if i am commenting the added lines then the apache works fine, but when i uncomment those lines apache doesn't works. :-(

Thanku those willing to help. :-)

Windows Event Viewer logs :-

[Sat Aug 10 19:00:05.852622 2019] [ssl:warn] [pid 9612:tid 560] AH01909: www.example.com:4433:0 server certificate does NOT include an ID which matches the server name
[Sat Aug 10 19:00:05.928109 2019] [core:warn] [pid 9612:tid 560] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat Aug 10 19:00:06.027802 2019] [ssl:warn] [pid 9612:tid 560] AH01909: www.example.com:4433:0 server certificate does NOT include an ID which matches the server name
[Sat Aug 10 19:00:06.049409 2019] [mpm_winnt:notice] [pid 9612:tid 560] AH00455: Apache/2.4.39 (Win64) OpenSSL/1.0.2s PHP/7.1.30 configured -- resuming normal operations
[Sat Aug 10 19:00:06.049409 2019] [mpm_winnt:notice] [pid 9612:tid 560] AH00456: Apache Lounge VC14 Server built: May 29 2019 14:38:49
[Sat Aug 10 19:00:06.049409 2019] [core:notice] [pid 9612:tid 560] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sat Aug 10 19:00:06.072102 2019] [mpm_winnt:notice] [pid 9612:tid 560] AH00418: Parent: Created child process 12636
[Sat Aug 10 19:00:06.769853 2019] [ssl:warn] [pid 12636:tid 524] AH01909: www.example.com:4433:0 server certificate does NOT include an ID which matches the server name
[Sat Aug 10 19:00:06.959523 2019] [ssl:warn] [pid 12636:tid 524] AH01909: www.example.com:4433:0 server certificate does NOT include an ID which matches the server name
[Sat Aug 10 19:00:06.981305 2019] [mpm_winnt:notice] [pid 12636:tid 524] AH00354: Child: Starting 150 worker threads.

2 Answers 2

1

Here https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst there are 4 requirements you should comply with.

As far as I can see, you fail to comply with the first rule, as you have Apache Win64 version Apache/2.4.39 (Win64) but you are using a 32 bit python version and mod_wsgi python37-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win32.pyd

Also, I noticed you say that you are using virtual environment. Make sure that your wsgi.py loads the virtual environment first. My file starts like that:

python_home='/path/to/the/djangoproject/venv'
activate_this=python_home+'/bin/activate_this.py'
with open(activate_this) as file_:
        exec(file_.read(), dict(__file__=activate_this))

Also, I recommend configuring mod_wsgi to run in Daemon Mode, by specifying the WSGIDaemonProcess and WSGIProcessGroup directives in your VirtualHost file.

Sign up to request clarification or add additional context in comments.

Comments

0

In the logs (in the configured step), it should display the WSGI module version too. But your log doesn't say anything about WSGI - so I suspect that you didn't do the WSGI setup correctly. I have posted an example log from my apache (of course it's different OS, but it should be similar).

[Fri Aug 02 13:51:39.962856 2019] AH00163: Apache/2.4.39 (Unix) mod_wsgi/4.6.7 Python/3.7 configured -- resuming normal operations

7 Comments

from cmd when i m running pip install mod_wsgi it shows the following Requirement already satisfied: mod_wsgi in c:\users\xxxxx\appdata\local\programs\py on37-32\lib\site-packages (4.6.7+ap24vc15)
pip install mod_wsgi will install WSGI into Python2 (not python3). Please use pip3 install mod_wsgi to install wsgi into python3. This is the step we follow for the setup in linux/mac. I guess, it should be same for windows too.
@P K pip3 install mod_wsgi also says requirement satisfied
In the httpd.conf you have <Directory "K:/Work/Net/first_project"> (OR) <Directory "K:/Work/Net/first_project/first_project">?
my wsgi.py file of project is stored in K:/Work/Net/first_project/first_project. i have my project in K:/Work/Net/first_project (file containing the manage.py)/ first_project(file containing setings.py, wsgi.py)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.