Flask on Mac OS X install, test 10.6 and
I wanted to try finally mod_wsgi to develop Python web applications on my Mac Mini. Installation of mod_wsgi using MacPorts proved to be very simple. The subsequent need to configure Apache2
Sunday, July 11, 2010
Kates Playground Harcore Vids
is expensive enough, so here I sometimes like to describe in detail:
0th under System Preferences / Sharing the Web share disable the turn off Apple's Mac OS X included Apache 2 server.
first Installation of mod_wsgi with MacPorts: > sudo port install mod_wsgi If not available, Apache2 is installed in this process.
second Starting and Testing Apache:
> sudo / opt/local/apache2/bin/apachectl k-star t After starting Apache you can
http://localhost open the browser. It should be "It works!" are shown.
third Apache start automatically at system startup:
> sudo launchctl load-w / Library/LaunchDaemons/org.macports.apache2.plist 4th Activation of the user directories so that web pages are the user name under
http://localhost/ ~ / Sites be displayed: This requires the line
in the file
# # Include user configurations
#
Include / private/etc/apache2/users / *. conf
add. Must then be restarted Apache2:
(Also see How to get a Apache, PHP, MySQL (MAMP) setup
.) 5th Activation of the mod_wsgi module for Apache2: be given must be added the line LoadModule
wsgi_module modules / mod_wsgi.so
/ opt/local/apache2/conf/httpd.conf
. Then restart Apache. 6th Create a
wsgi
applications: wsgi
> pico hello.wsgi
import sys def
status = '200 OK 'output
=' Hello World \\ n '
output + = str (sys.path)
return [output]
you are
"Hello World!" back and in addition the system path under which examines the wsgi module for Python modules (See also mod_wsgi - Quick Configuration Guide ).
7th Setting up a Virtual Host
wsgi applications: For this, the line
Include conf / extra / httpd-vhosts.conf
ServerName www.mydomain.org
ServerAdmin webmaster@mydomain.org
\u0026lt;Directory /Users/username/Sites/webapp>
Order allow, deny Allow from
\u0026lt;/ VirtualHost>
mydomain.org for the domain name, my.dyndns.org
for there may dynamic DNS - entry. (How to use Virtual Hosts can do better with DynDNS is at Virtual hosts and DynDNS combine it
. The Wildcard feature mentioned there, however, costs $ 15 a year). WSGIScriptAlias indicates that the root address "/"
the virtual server the wsgi application hello.wsgi
WSGIScriptReloading activate, so you do not need to restart for every change of the wsgi application to the Apache server. More in mod_wsgi - Quick Configuration Guide . be restarted after configuring the virtual hosts, the Apache server again. However, given the work Domain name yet. To do this yet in the file / private / etc / hosts the lines 127.0.0.1 mydomain.org
8th Calling http://mydomain.org or
http://www.mydomain.org with the browser:
If all went well you should now
"Hello World!" see in the browser, including the Python system path.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment