freezing a django app with mod_wisg and apache

25 views
Skip to first unread message

stma137

unread,
May 23, 2019, 6:10:45 PM5/23/19
to modwsgi
Is there a way I can create a bundle using Pyinstaller of a Django application served by mod_wsgi and Apache? Basically freeze my python source before sending installers to users.
My application has to work on both Linux and Windows. I have so far been using fastcgi and flup. But Just dropped support for fastcgi, and recommends using mod_wsgi with Apache.

The problem I am facing right now is that the apache configuration is expecting a name of  a Python file `wsgi.py` for both `WSGIScriptAlias` and in `<Files\>` under `<Directory\>. However,
after running Pyinstaller on my project, I don't have any python file.

Is there a way around this?

I greatly appreciate your help.

Thanks!

Graham Dumpleton

unread,
May 23, 2019, 6:16:01 PM5/23/19
to mod...@googlegroups.com
For Linux you might be able to do it.

You want to have both 'mod_wsgi-httpd' and 'mod_wsgi' in requirements.txt file. The first is going to build and bundle your own Apache which subsequent mod_wsgi module install will use.

Only thing am concerned about is how to ensure that mod_wsgi-httpd is installed first as there is no dependency on it for mod_wsgi and install order by pip may be unpredictable. I don't know how PyInstaller works and how you give it list of modules to install.

Next use the Django integration for mod_wsgi-express.


This approach will not work on Windows.

Graham

stma137

unread,
May 23, 2019, 7:32:42 PM5/23/19
to modwsgi
Thank you Graham!

These are really great options to try. I was starting to feel like this was impossible.
And on your first option, I am almost sure that pip will respect the order of entries
in the requirements.txt.

Are you saying that both of these suggestions will almost definitely not work on Windows?
I'll have to think about a Windows alternative.

Thank you so much again!

Graham Dumpleton

unread,
May 23, 2019, 7:34:37 PM5/23/19
to mod...@googlegroups.com
There is no mod_wsgi-httpd package that works on Windows. You would need to work out how to bundle your own Apache distribution somehow. Also, neither the mod_wsgi-expess start-server command or Django admin command integration work on Windows anyway.

-- 
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 post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/35078eca-3ff4-4144-a268-16eb9eaceed7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

stma137

unread,
May 23, 2019, 8:32:19 PM5/23/19
to modwsgi
Very clear. I greatly appreciate your time. Thank you so much!

I am still not sure what direction I will take from here, but you have cleared my mind. This freezing process is not trivial, especially
when you have to consider multiple OSs. This is probably a place where releasing docker containers would help.
In which case effort will only go to figuring out freezing for one OS (the docker container).

Thank you so much again. I very much appreciate your help!

~ Sanele
To unsubscribe from this group and stop receiving emails from it, send an email to mod...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages