Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when starting server #844

Open
Erispoe974 opened this issue Jun 26, 2023 · 10 comments
Open

Error when starting server #844

Erispoe974 opened this issue Jun 26, 2023 · 10 comments

Comments

@Erispoe974
Copy link

Hi,
I'm trying to install mod_wsgi for running with Apache server V2.4.54.
After the pip installation, i try to check if it works with mod_wsgi-express start-server but i got an error :

Server URL : http://localhost:8000/
Server Root : C:/Users/ADMINI1/AppData/Local/Temp/2/mod_wsgi-localhost-8000-Administrateur
Server Conf : C:/Users/ADMINI
1/AppData/Local/Temp/2/mod_wsgi-localhost-8000-Administrateur/httpd.conf
Error Log File : C:/Users/ADMINI~1/AppData/Local/Temp/2/mod_wsgi-localhost-8000-Administrateur/error_log (warn)
Operating Mode : daemon
Request Capacity : 5 (1 process * 5 threads)
Request Timeout : 60 (seconds)
Startup Timeout : 15 (seconds)
Queue Backlog : 100 (connections)
Queue Timeout : 45 (seconds)
Server Capacity : 20 (event/worker), 20 (prefork)
Server Backlog : 500 (connections)
Locale Setting : fr_FR.cp1252

WARNING: The ability to use the start-server option on Windows
WARNING: is highly experimental and various things don't quite
WARNING: work properly. If you understand a lot about using
WARNING: Python on Windows and Windows programming in general,
WARNING: and would like to help to get it working properly, then
WARNING: you can ask about Windows support for the start-server
WARNING: option on the mod_wsgi mailing list.

Traceback (most recent call last):
File "C:\Program Files\Python311\Scripts\mod_wsgi-express-script.py", line 33,
in
sys.exit(load_entry_point('mod-wsgi==4.9.4', 'console_scripts', 'mod_wsgi-express')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\mod_wsgi\server_init_.py", line 3839, in main
cmd_start_server(args)
File "C:\Program Files\Python311\Lib\site-packages\mod_wsgi\server_init_.py", line 3672, in cmd_start_server
subprocess.call([executable]+httpd_arguments)
File "C:\Program Files\Python311\Lib\subprocess.py", line 389, in call
with Popen(*popenargs, **kwargs) as p:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\Python311\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable

Could you help me ?
My root apache directory : C:\wamp64\bin\apache\apache2.4.54.2

Thx for your help.
Regards,
Alexandre

@GrahamDumpleton
Copy link
Owner

As the message which is displayed indicates when it is started, mod_wsgi-express start-server on Windows isn't really supported and doesn't necessarily work. You need to manually configure Apache httpd on Windows to use the mod_wsgi module.

@Erispoe974
Copy link
Author

Hi, Thanks for your ansswer.
It's what i'have done. And since it didn't work, I tried running this command to understand.
Because, when i restart apache with mod_wsgi, none of my websites are working anymore, I have a 500 error

@GrahamDumpleton
Copy link
Owner

What are the error messages in the Apache error log?

@Erispoe974
Copy link
Author

Here is my configuration in httpd.conf :
# Django Project
LoadFile "C:/Program Files/Python311/python311.dll"
LoadModule wsgi_module "C:/Program Files/Python311/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp311-win_amd64.pyd"
WSGIPythonHome "C:/Program Files/Python311"
WSGIScriptAlias / "C:/wamp64/www/BioSite_33/src/wsgi.py"
WSGIPythonPath "C:/wamp64/www/BioSite_33/"

I have no really errors :
[Wed Jun 28 13:52:02.043268 2023] [mpm_winnt:notice] [pid 2136:tid 252] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Wed Jun 28 13:52:04.090160 2023] [mpm_winnt:notice] [pid 4104:tid 268] AH00364: Child: All worker threads have exited.
[Wed Jun 28 13:52:09.558961 2023] [mpm_winnt:notice] [pid 2136:tid 252] AH00430: Parent: Child process 4104 exited successfully.
[Wed Jun 28 13:52:58.005595 2023] [mpm_winnt:notice] [pid 4640:tid 252] AH00455: Apache/2.4.54 (Win64) PHP/8.0.26 mod_fcgid/2.3.10-dev mod_wsgi/4.9.4 Python/3.11 configured -- resuming normal operations
[Wed Jun 28 13:52:58.005595 2023] [mpm_winnt:notice] [pid 4640:tid 252] AH00456: Apache Lounge VS16 Server built: Nov 2 2022 10:09:33
[Wed Jun 28 13:52:58.005595 2023] [core:notice] [pid 4640:tid 252] AH00094: Command line: 'c:\wamp64\bin\apache\apache2.4.54.2\bin\httpd.exe -d C:/wamp64/bin/apache/apache2.4.54.2'
[Wed Jun 28 13:52:58.005595 2023] [mpm_winnt:notice] [pid 4640:tid 252] AH00418: Parent: Created child process 2596
[Wed Jun 28 13:52:58.552476 2023] [mpm_winnt:notice] [pid 2596:tid 268] AH00354: Child: Starting 64 worker threads.

@GrahamDumpleton
Copy link
Owner

Ensure LogLevel in Apache is set to at least info and not err or warn. This will give extra information about what mod_wsgi is doing and whether it is even attempting to load your WSGI application. Because you have mod_fcgid loaded, it could be highjacking the request, as could mod_cgi depending on what other config you have.

@Erispoe974
Copy link
Author

I change httpd.conf the LogLevel to Info, and the result :
[Wed Jun 28 15:58:50.114456 2023] [mpm_winnt:notice] [pid 3508:tid 252] AH00455: Apache/2.4.54 (Win64) PHP/8.0.26 mod_fcgid/2.3.10-dev mod_wsgi/4.9.4 Python/3.11 configured -- resuming normal operations
[Wed Jun 28 15:58:50.114456 2023] [mpm_winnt:notice] [pid 3508:tid 252] AH00456: Apache Lounge VS16 Server built: Nov 2 2022 10:09:33
[Wed Jun 28 15:58:50.114456 2023] [core:notice] [pid 3508:tid 252] AH00094: Command line: 'c:\wamp64\bin\apache\apache2.4.54.2\bin\httpd.exe -d C:/wamp64/bin/apache/apache2.4.54.2'
[Wed Jun 28 15:58:50.115448 2023] [mpm_winnt:notice] [pid 3508:tid 252] AH00418: Parent: Created child process 4732
[Wed Jun 28 15:58:50.498710 2023] [wsgi:info] [pid 4732:tid 276] mod_wsgi (pid=4732): Initializing Python.
[Wed Jun 28 15:58:50.543764 2023] [wsgi:info] [pid 4732:tid 276] mod_wsgi (pid=4732): Attach interpreter ''.
[Wed Jun 28 15:58:50.557751 2023] [wsgi:info] [pid 4732:tid 276] mod_wsgi (pid=4732): Adding 'C:/Program Files/Python311/Lib/site-packages' to path.
[Wed Jun 28 15:58:50.560777 2023] [wsgi:info] [pid 4732:tid 276] mod_wsgi (pid=4732): Adding 'C:/wamp64/www/BioSite_33/' to path.
[Wed Jun 28 15:58:50.588797 2023] [wsgi:info] [pid 4732:tid 276] mod_wsgi (pid=4732): Imported 'mod_wsgi'.
[Wed Jun 28 15:58:50.589797 2023] [mpm_winnt:notice] [pid 4732:tid 276] AH00354: Child: Starting 64 worker threads.
[Wed Jun 28 15:59:14.397548 2023] [wsgi:info] [pid 4732:tid 1160] mod_wsgi (pid=4732): Create interpreter 'localhost|'.
[Wed Jun 28 15:59:14.412534 2023] [wsgi:info] [pid 4732:tid 1160] mod_wsgi (pid=4732): Adding 'C:/Program Files/Python311/Lib/site-packages' to path.
[Wed Jun 28 15:59:14.419540 2023] [wsgi:info] [pid 4732:tid 1160] mod_wsgi (pid=4732): Adding 'C:/wamp64/www/BioSite_33/' to path.
[Wed Jun 28 15:59:14.462575 2023] [wsgi:info] [pid 4732:tid 1160] [client 10.33.6.10:64032] mod_wsgi (pid=4732, process='', application='localhost|'): Loading Python script file 'C:/wamp64/www/BioSite_33/src/wsgi.py'.

@GrahamDumpleton
Copy link
Owner

The WSGI application is at least being loaded. The fact that there is no trace back though indicates that if the 500 error is being generated as a result of the WSGI application, that the web framework you are using is internally capturing the error and turning it into a HTTP 500 response itself, without logging the details.

This lack of logging for internal code errors and return a HTTP 500 response is what some Python web frameworks will do unless you specifically configure them to log details of the exceptions. What Python web framework are you using?

@Erispoe974
Copy link
Author

Thanks for your answers.
My framework : Django

Regards,
Alexandre

@GrahamDumpleton
Copy link
Owner

Have a read of:

At the minimum, set Django DEBUG mode on to work out what the error is.

@Erispoe974
Copy link
Author

Debug_mode is already on TRUE, but no error on the ie or chrome.
And we finely finf the issue :
If i add "WSGIScriptAlias / "C:/wamp64/www/BioSite_33/src/wsgi.py"" in httpd.conf file, the serveur doen't anwser, no error.
This line must be adding into httpd-vhosts.conf file beteween and

Thanks a lot GrahamDumpleton, you're a boss and you was very helpfull.

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants