How does one deploy a django application on OS X Server?

后端 未结 3 2013
北海茫月
北海茫月 2021-02-06 11:49

How would one deploy a Django application on OS X Server 2.0 without using homebrew or a different flavor of python than the one shipped with OS X 10.8.1? I\'m using the cocoa b

相关标签:
3条回答
  • 2021-02-06 12:13

    Some Apache configurations with distros map .py to either CGI or FASTCGI and this will conflict with mod_wsgi. This is why mod_wsgi recommends using a .wsgi extension. So, rename 'wsgi.py' to 'site.wsgi' and then use 'site.wsgi' in the WSGIScriptAlias.

    BTW, can you confirm that there is a precompiled mod_wsgi.so shipped with Mountain Lion server.

    0 讨论(0)
  • 2021-02-06 12:27

    I found myself struggling to migrate my macports django to Mountain Lion Server 10.8.2, and for some reason the answers here helped me remember the mod_wsgi.so differences.

    I overwrote the /Applications/Server.app/Contents/ServerRoot/usr/libexec/apache2/mod_wsgi.so with my /opt/local/apache2/modules/mod_wsgi.so.

    I was hoping to remove the MacPorts apache2 completely, but I think I better keep it around. I still prefer MacPorts Python at the moment, since it is easier to keep up to date with the numerically intensive packages.

    Yes, also make sure you change that wsgi.py to wsgi.wsgi.

    I copied httpd_wsgi.conf to httpd_mywsgi.conf; I added my django.wsgi to /Library/Server/Web/Data/WebApps.
    In /Library/Server/Web/Config/apache2/webapps, I copied the com.apple.webapp.wsgi.plist.

    It looks like you chose the same plist pattern.

    I am still working out my static content, however, thought the mod_wsgi.so discovery could help someone else migrating from MacPorts.

    0 讨论(0)
  • 2021-02-06 12:27

    Two things:

    1. If you want to use the WSGIScriptAlias directive you need to have the mod_wsgi apache module. I don't have OS X server but as far as I can see the module does not exists in the /usr/libexec/apache2 folder on mountain lion standard. You gonna have to download it from here. Don't know if the command line tools are included in the OS X server. I do need to install X code to get them on the standard version. There seems to be some instruction on how to install it on macos x

    2. Have a look at Homebrew. This is a really great way to add extra software to the mac. In a twist you could install the latest python, nginx and uwsgi. Nginx and uwsgi is a great way to deploy django apps. I find it more flexible and efficient than mod_wsgi (this second point is highly subjective).

    Good luck

    0 讨论(0)
提交回复
热议问题