Softaculous


Topic : python configuration


Posted By: Cody on September 4, 2012, 11:13 pm
With a fresh install of AMPPS 1.9 I got an error when using python with mod_wsgi. (python 2.7 is also installed systemwide) A minimal wsgi app works, but when I add the line
Code
import sqlite3
I get an error 500.
I studied the configuration and the lines
Code
WSGIPythonPath "{$path}\python"
and
Code
WSGIPythonHome "
{$path}
\python\Lib;
{$path}
\python\Lib\site-packages;
{$path}
\python\DLLs"
seemed wrong to me. After exchanging the values importing the sqlite3 module worked. This also makes more sense to me with the documentation of this directives in mind.
Are these values mixed up in the default configuration?

Posted By: tidus on September 10, 2012, 6:12 am | Post: 1
Hi,

In Ampps folder, you should be able to find two python.conf

One is located in Ampps/conf folder and other in Ampps/python folder

If you want to do any changes, make the changes in Ampps/conf/python.conf but don't replace {$path} as AMPPS will replicate it with correct path in Ampps/python/python.conf

Note: Ampps Application should be running.

-----------------------
Follow AMPPS on,
Twitter : https://twitter.com/AMPPS_Stack
Facebook :  http://www.facebook.com/softaculousampps
Google+ : https://plus.google.com/+AmppsStack

Posted By: Cody on September 10, 2012, 3:17 pm | Post: 2
Thanks for your reply. I already found out where to do the changes. But I would name it a bug if builtin parts of python fail with the default configuration.
I made the prevously mentioned changes in the Ampps/cond/python.conf file. After applying the changes the sqlite3 builtin-libary of python worked.
But with the default python.conf of Ampps 1.9 it didn't.
When running any python.exe on the system directly sqlite3 also works fine. So the mentioned lines in the Ampps/conf/python.conf file.
According to the documentation of mod_wsgi the value of "WSGIPythonHome" should point to the directory of python.exe. So the default value with ampps makes no sense, as there are multiple directories.

Posted By: tidus on September 11, 2012, 7:04 am | Post: 3
Hi,

Can you give us the small script in which you were facing the error. We will regenerate it and fix it in next version of AMPPS.

-----------------------
Follow AMPPS on,
Twitter : https://twitter.com/AMPPS_Stack
Facebook :  http://www.facebook.com/softaculousampps
Google+ : https://plus.google.com/+AmppsStack

Posted By: Cody on September 11, 2012, 9:07 am | Post: 4
The following Script fails with default python.conf:
Code
import sqlite3
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]

Posted By: Cody on September 11, 2012, 9:11 am | Post: 5
sorry, small typo in the script:
Code
import sqlite3


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]

Posted By: aniceman on August 1, 2013, 12:13 pm | Post: 6
I have managed to get Python to work with AMPPS  thank you.
How do you get Ruby to work with AMPPS.

Posted By: tidus on August 1, 2013, 12:37 pm | Post: 7
Quote From : aniceman August 1, 2013, 12:13 pm
I have managed to get Python to work with AMPPS  thank you.
How do you get Ruby to work with AMPPS.


Hi,

Sorry we do not provide Ruby with AMPPS. You will have to install it on your own.


-----------------------
Follow AMPPS on,
Twitter : https://twitter.com/AMPPS_Stack
Facebook :  http://www.facebook.com/softaculousampps
Google+ : https://plus.google.com/+AmppsStack

Posted By: aniceman on August 2, 2013, 9:01 am | Post: 8
I have already installed Ruby.

I have changed the line in C:\Program Files\Ampps\apache\config\httpd.conf

AddHandler cgi-script .cgi .pl .py .rb

I have ruby installed in  C:\Ruby200


What else do I need to change in the Apache config file to get to work.

I would greatfull any help, I sure other people will want to do this as well.

Posted By: tidus on August 2, 2013, 9:21 am | Post: 9
Quote From : aniceman August 2, 2013, 9:01 am
I have already installed Ruby.

I have changed the line in C:\Program Files\Ampps\apache\config\httpd.conf

AddHandler cgi-script .cgi .pl .py .rb

I have ruby installed in  C:\Ruby200


What else do I need to change in the Apache config file to get to work.

I would greatfull any help, I sure other people will want to do this as well.


Hi,

Don't change the conf file directly. Change it from AMPPS Application -> Apache Tab -> Configuration.

I think that is all. Now just restart apache. And put the following ruby script in path Ampps\www\cgi-bin\test.rb
Code
#!"C:\Ruby200\ruby.exe"
puts "Content-type: text/html"
puts ""
puts ""
puts ""
puts "Test Ruby Page."
puts ""
puts ""
Make sure path to ruby.exe is correct.


-----------------------
Follow AMPPS on,
Twitter : https://twitter.com/AMPPS_Stack
Facebook :  http://www.facebook.com/softaculousampps
Google+ : https://plus.google.com/+AmppsStack

Posted By: aniceman on August 2, 2013, 1:38 pm | Post: 10
My file is in the Ampps\www\cgi-bin
and is almost the same as your file.

But I had made one typing mistake which I have now corrected and it works fine.

So now anybody else can now use Ruby with AMPPS

Which  I am sure will be useful to one else as well.

Thank you.


Powered By AEF 1.0.8 © 2007-2008 Electron Inc.