Welcome Guest. Please Login or Register  


You are here: Index > AMPPS > Bugs > Topic : python configuration



Threaded Mode | Print  

 python configuration (10 Replies, Read 34298 times)
Cody
Group: Member
Post Group: Newbie
Posts: 4
Status:
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?
IP: --   

python configuration
tidus
Group: Member
Post Group: Super Member
Posts: 1123
Status:
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
IP: --   

python configuration
Cody
Group: Member
Post Group: Newbie
Posts: 4
Status:
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.
IP: --   

python configuration
tidus
Group: Member
Post Group: Super Member
Posts: 1123
Status:
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
IP: --   

python configuration
Cody
Group: Member
Post Group: Newbie
Posts: 4
Status:
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]
IP: --   

python configuration
Cody
Group: Member
Post Group: Newbie
Posts: 4
Status:
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]
IP: --   

python configuration
aniceman
Group: Member
Post Group: Newbie
Posts: 3
Status:
I have managed to get Python to work with AMPPS  thank you.
How do you get Ruby to work with AMPPS.
IP: --   

python configuration
tidus
Group: Member
Post Group: Super Member
Posts: 1123
Status:
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
IP: --   

python configuration
aniceman
Group: Member
Post Group: Newbie
Posts: 3
Status:
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.
IP: --   

python configuration
tidus
Group: Member
Post Group: Super Member
Posts: 1123
Status:
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
IP: --   

python configuration
aniceman
Group: Member
Post Group: Newbie
Posts: 3
Status:
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.

IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is December 12, 2018, 7:41 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.448