How do I run wsgi locally for local development?

41 views
Skip to first unread message

Mitt Frag

unread,
May 14, 2020, 6:31:26 PM5/14/20
to modwsgi
I currently have a setup where my React client interacts with a Flask backend which is daemonized with WSGI through Apache. The problem I have now is that to develop this way I have to rebuild the client which can take 1-2 minutes each time, Apache then picks up the build files. The reason I am forced to do this is because I cannot run my main server.py file just via the command line via
python server.py

because this file now relies on request.environ() which I assume is exclusive to WSGI. Ideally, I would be able to run my React application in development mode (takes no time at all to start-up) and would be able to run my server.py file using WSGI locally as opposed to via daemonizing it via the Apache config. Is there a way I can run WSGI locally like this? From my initial research it seems that I might want to download modwsgi-standalone and then make use of modwsgi-express?

Graham Dumpleton

unread,
May 14, 2020, 7:14:10 PM5/14/20
to mod...@googlegroups.com
If you are using Flask, you can run the Flask development server. This is a WSGI server still, and the per request WSGI environ should still be present.

What in the WSGI environ are you expecting to see if you are already doing that and something isn't present?
You only need 'mod_wsgi-standalone' if for some reason you can use the system Apache (runtime+dev packages installed). If the system Apache exists (with those dev header files and apxs), then you can 'pip install mod_wsgi' to get mod_wsgi-express. In other words, the 'mod_wsgi-standalone' package also installs an Apache instance, which you don't need if you have system Apache installed anyway.

Graham

Mitt Frag

unread,
May 26, 2020, 1:59:32 PM5/26/20
to modwsgi
Hi Graham. Really sorry about the late reply here. I am missing a variable related to SSL. I ran the app locally using 'python server.py' and the output says it is running as a https server however the SSL variable that is normally there isn't there in local development. I'm not sure if it's related to the http requests I'm making from the frontend? I make the same calls in production with the same protocol and I can see that SSL variable though.

Graham Dumpleton

unread,
May 26, 2020, 5:53:28 PM5/26/20
to mod...@googlegroups.com
What SSL variable are you talking about?

-- 
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/c6bdbc08-7aad-41fb-952d-e342dea658b8%40googlegroups.com.

Mitt Frag

unread,
May 26, 2020, 6:36:27 PM5/26/20
to modwsgi
Basically the ones listed https://httpd.apache.org/docs/current/mod/mod_ssl.html here which, after realising it's because I'm not using Apache locally, kind of leads me into another question. How do I access variables like these locally if I'm not running my app through Apache any more?
To unsubscribe from this group and stop receiving emails from it, send an email to mod...@googlegroups.com.

Graham Dumpleton

unread,
May 26, 2020, 6:39:02 PM5/26/20
to mod...@googlegroups.com
Whether you have information like that available is web server specific. Python based web servers don't usually provide such information as far as I know.

To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/e78de8ff-94f6-401d-a81b-2b74c459de56%40googlegroups.com.

Mitt Frag

unread,
May 30, 2020, 1:21:11 PM5/30/20
to modwsgi
Thanks for the help.
To unsubscribe from this group and stop receiving emails from it, send an email to mod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/e78de8ff-94f6-401d-a81b-2b74c459de56%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages