Page 2 of 2 | << | < | 1 | 2 | All |
Posted By: tidus on January 21, 2013, 6:30 pm | Post: 16 |
Hi,
Just checked it again. Its working fine i.e I am able to print Hello World. I refered http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide ----------------------- Follow AMPPS on, Twitter : https://twitter.com/AMPPS_Stack Facebook : http://www.facebook.com/softaculousampps Google+ : https://plus.google.com/+AmppsStack |
Posted By: tidus on January 21, 2013, 6:36 pm | Post: 18 |
Quote From : memzxi January 21, 2013, 6:35 pm Hmz, maybe I was doing something wrong. If you have some spare time consider making a video, just recording your screen while you install ampps and doing the things until hello world is printed. It would help a lot for newbies like me. I don't need it now as I decided to go with php with this project, but I might come back to check python
Yes. Sure. ----------------------- Follow AMPPS on, Twitter : https://twitter.com/AMPPS_Stack Facebook : http://www.facebook.com/softaculousampps Google+ : https://plus.google.com/+AmppsStack |
Posted By: chrisjensen23 on March 26, 2014, 4:07 pm | Post: 19 |
OK, so I got it working on my mac and thought I would share what I did to get it to work. I followed most of what was in this thread, but with some modifications:
1- Install Ampps 2 - make a folder in your Ampps installation folder, in my case it was here: /Applications/AMPPS/www/wsgi-scripts 3 - In the httpd.conf file found here: /Applications/AMPPS/conf configure Apache to allow WSGI scripts, I added the following lines to the virtualhost portion of the httpd.conf Code <Directory "/Applications/AMPPS/www/wsgi-scripts">
Order allow,deny Allow from all </Directory> WSGIScriptAlias /myapp "/Applications/AMPPS/www/wsgi-scripts/myapp.wsgi" So the whole virtualhost tag looked like this: Code <VirtualHost 127.0.0.1:80>
<Directory "/Applications/AMPPS/www"> Options FollowSymLinks Indexes AllowOverride All Order deny,allow allow from All </Directory> ServerName localhost ServerAlias localhost 127.0.0.1 ScriptAlias /cgi-bin/ "/Applications/AMPPS/www/cgi-bin/" DocumentRoot "/Applications/AMPPS/www" ErrorLog "/Applications/AMPPS/apache/logs/error_log" CustomLog "/Applications/AMPPS/apache/logs/access.log" combined <Directory "/Applications/AMPPS/www/wsgi-scripts"> Order allow,deny Allow from all </Directory> WSGIScriptAlias /myapp "/Applications/AMPPS/www/wsgi-scripts/myapp.wsgi" </VirtualHost> 4 - Edit the python.conf file, located here: /Applications/AMPPS/conf to look like this: Code LoadModule wsgi_module modules/mod_wsgi.so
<IfModule wsgi_module> DirectoryIndex index.wsgi default.wsgi index.py default.py </IfModule> WSGIPythonPath "/Applications/AMPPS/python/Lib;/Applications/AMPPS/python/Lib/site-packages;/Applications/AMPPS/python/DLLs" WSGIPythonHome "/Applications/AMPPS/python" 5-Make a test WSGI application and save it as myapp.wsgi so it should reside in the following folder: /Applications/AMPPS/www/wsgi-scripts/ Paste the following code into the myapp.wsgi file that you created: Code def application(environ, start_response):
status = '200 OK' output = 'Hello World!' response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output] 6 - Restart Apache in Ampps (if it is already open) or Start it for the first time. 7 - load your python test app at http://localhost/myapp That should do it! Quote From : memzxi December 26, 2012, 8:04 pm Hi. Another newbie here. I thank you for your work creating the product and giving it for free, but after that much work, is it that hard to make Python run by default ?
If I want to run php, I put test.php file in www directory and it works fine. I put test.py and it shows unprocessed source code, the same as it would if I opened it in a browser without AIMPS installed. Can you just say which file to put where in order for it to work ? I read quick configuration guide that you posted a link to, but it doesn't seem to help properly. What I did is put the code below in C:\Program Files\Ampps\apache\conf\httpd.conf in line 634 after << # Python Include "C:/Program Files/Ampps/python/python.conf" >> Quote <VirtualHost *:80>
ServerName localhost ServerAlias 127.0.0.1 ServerAdmin webmaster@example.com DocumentRoot /usr/local/www/documents <Directory /usr/local/www/documents> Order allow,deny Allow from all </Directory> WSGIScriptAlias /myapp /usr/local/www/wsgi-scripts/myapp.wsgi <Directory /usr/local/www/wsgi-scripts> Order allow,deny Allow from all </Directory> </VirtualHost> After that, I created the file C:\Program Files\Ampps\www\wsgi-scripts\myapp.wsgi and put the code below in it. the code is from that "quick" configuration guide Quote def application(environ, start_response): status = '200 OK' output = 'Hello World!' response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output] Then I restarted apache, tried to access http://localhost/documents/test.py http://localhost/test.py http://localhost/wsgi-scripts/test.py none worked, help ? ( AMPPS installation is fresh, nothing modified ) |
Posted By: tidus on July 23, 2014, 7:27 am | Post: 21 |
Hi,
The folder will be /usr/local/ampps/www/cgi-bin and keep the file extension .cgi ----------------------- Follow AMPPS on, Twitter : https://twitter.com/AMPPS_Stack Facebook : http://www.facebook.com/softaculousampps Google+ : https://plus.google.com/+AmppsStack |
Posted By: Akirami on December 8, 2014, 12:09 pm | Post: 23 |
Quote From : chrisjensen23 March 26, 2014, 4:07 pm OK, so I got it working on my mac and thought I would share what I did to get it to work. I followed most of what was in this thread, but with some modifications:
1- Install Ampps 2 - make a folder in your Ampps installation folder, in my case it was here: /Applications/AMPPS/www/wsgi-scripts 3 - In the httpd.conf file found here: /Applications/AMPPS/conf configure Apache to allow WSGI scripts, I added the following lines to the virtualhost portion of the httpd.conf Code <Directory "/Applications/AMPPS/www/wsgi-scripts">
Order allow,deny Allow from all </Directory> WSGIScriptAlias /myapp "/Applications/AMPPS/www/wsgi-scripts/myapp.wsgi" So the whole virtualhost tag looked like this: Code <VirtualHost 127.0.0.1:80>
<Directory "/Applications/AMPPS/www"> Options FollowSymLinks Indexes AllowOverride All Order deny,allow allow from All </Directory> ServerName localhost ServerAlias localhost 127.0.0.1 ScriptAlias /cgi-bin/ "/Applications/AMPPS/www/cgi-bin/" DocumentRoot "/Applications/AMPPS/www" ErrorLog "/Applications/AMPPS/apache/logs/error_log" CustomLog "/Applications/AMPPS/apache/logs/access.log" combined <Directory "/Applications/AMPPS/www/wsgi-scripts"> Order allow,deny Allow from all </Directory> WSGIScriptAlias /myapp "/Applications/AMPPS/www/wsgi-scripts/myapp.wsgi" </VirtualHost> 4 - Edit the python.conf file, located here: /Applications/AMPPS/conf to look like this: Code LoadModule wsgi_module modules/mod_wsgi.so
<IfModule wsgi_module> DirectoryIndex index.wsgi default.wsgi index.py default.py </IfModule> WSGIPythonPath "/Applications/AMPPS/python/Lib;/Applications/AMPPS/python/Lib/site-packages;/Applications/AMPPS/python/DLLs" WSGIPythonHome "/Applications/AMPPS/python" 5-Make a test WSGI application and save it as myapp.wsgi so it should reside in the following folder: /Applications/AMPPS/www/wsgi-scripts/ Paste the following code into the myapp.wsgi file that you created: Code def application(environ, start_response):
status = '200 OK' output = 'Hello World!' response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output] 6 - Restart Apache in Ampps (if it is already open) or Start it for the first time. 7 - load your python test app at http://localhost/myapp That should do it! Hi there, After 2 days, i succeded run mod_wsgi whit AMPPS (OS X Yosemite). The only thing i make is that change: Code <VirtualHost 127.0.0.1:80> to Code *:80 and Quote ServerAlias localhost 127.0.0.1
to Code ServerAlias localhost *
And the whole Virtualhost (httpd.conf): Quote <VirtualHost *:80> <Directory "/Applications/AMPPS/www"> Options FollowSymLinks Indexes AllowOverride All Order deny,allow allow from All </Directory> ServerName localhost ServerAlias localhost * ScriptAlias /cgi-bin/ "/Applications/AMPPS/www/cgi-bin/" DocumentRoot "/Applications/AMPPS/www" ErrorLog "/Applications/AMPPS/apache/logs/error_log" CustomLog "/Applications/AMPPS/apache/logs/access.log" combined <Directory "/Applications/AMPPS/www/wsgi-scripts"> Order allow,deny Allow from all </Directory> WSGIScriptAlias /myapp "/Applications/AMPPS/www/wsgi-scripts/myapp.wsgi" </VirtualHost> Hope it can help someone else. |
Posted By: KenScape on August 27, 2016, 8:05 pm | Post: 25 |
Perd01: I wonder what that does |