apache2 and python ?

Here you can discuss every aspect of Debian. Note: not for support requests!

apache2 and python ?

Postby 1885 » 2018-09-29 13:30

I'm looking for a guide to run some python script using apache2
I am doing this as a learning experience not for development.
With eventual connection to mariadb.

There are a lot of guides but I have not found an easy to follow debian guide.

Please throw me a bone.

doduckgo give the following:
https://duckduckgo.com/?q=debian+python ... t=h_&ia=qa
1885
 
Posts: 111
Joined: 2014-06-05 04:23

Re: apache2 and python ?

Postby arzgi » 2018-09-29 13:48

Code: Select all
aptitude search python | grep apache
p  libapache2-mod-python - Python-embedding module for Apache 2
p  libapache2-mod-python-doc - Python-embedding module for Apache 2 - documentation
p  python-certbot-apache - Apache plugin for Certbot
p  python-certbot-apache-doc - Apache plugin documentation for Certbot


Python is a programming language, apache web server. Neither is Debian spesific.
arzgi
 
Posts: 387
Joined: 2008-02-21 17:03
Location: Finland

Re: apache2 and python ?

Postby 1885 » 2018-09-29 13:53

arzgi wrote:
Code: Select all
aptitude search python | grep apache
p  libapache2-mod-python - Python-embedding module for Apache 2
p  libapache2-mod-python-doc - Python-embedding module for Apache 2 - documentation
p  python-certbot-apache - Apache plugin for Certbot
p  python-certbot-apache-doc - Apache plugin documentation for Certbot


Python is a programming language, apache web server. Neither is Debian spesific.


thank you.
I understand that . I was hoping to get spoon fed a bit more (Laughing)
I'm a bit lazy with this.

I'll look at how to implement the following with my current *.conf sites-enabled file:

# apt-cache search python | grep apache
libapache-directory-jdbm-java - ApacheDS JDBM Implementation
libapache2-mod-auth-tkt - lightweight single-sign-on authentication module for Apache
libapache2-mod-python - Python-embedding module for Apache 2
libapache2-mod-python-doc - Python-embedding module for Apache 2 - documentation
libapache2-mod-wsgi - Python WSGI adapter module for Apache
libapache2-mod-wsgi-py3 - Python 3 WSGI adapter module for Apache
python-certbot-apache - Apache plugin for Certbot
python-certbot-apache-doc - Apache plugin documentation for Certbot
1885
 
Posts: 111
Joined: 2014-06-05 04:23

Re: apache2 and python ?

Postby arzgi » 2018-09-29 15:20

http://www.diveintopython.net / http://www.diveintopython3.net were the first manuals I read when I started studying python, those I can recommend. https://docs.python.org/3/ has more good docs.

Apache I have not used, but it is so popular, that I would think there are manuals written for it too.
arzgi
 
Posts: 387
Joined: 2008-02-21 17:03
Location: Finland

Re: apache2 and python ?

Postby jibberjabber » 2018-09-29 16:13

Lesson #115 Giving the Dog a bone

I'm looking for a guide to run some python script using apache2

I am doing this as a learning experience not for development.

A good learning experience, is include learning how to read the results in a search.
To enhance that experience, and learn even more, start experimenting with some scripts,
python, or whatever, and try some .

Please throw me a bone.

There you go, there is the bone, fetch it.
I understand that . I was hoping to get spoon fed a bit more (Laughing)
I'm a bit lazy with this.

Lazy dogs never get off the porch, if you are to lazy to go hunt for something that has
actual meat, stay on the porch, and chew the bones that get thrown to you.
was hoping to get spoon fed a bit more (Laughing)

You will need to ask your mommy or daddy to do that, or ask them to hire a nanny to do the spoon feeding. :mrgreen:
Hope this was a good learning experience. :mrgreen:
P.S. What does this have to do with configuring a Debian system ? ,.. we do have a off topic, and general discussion boards for this kind of thing. For help with a python script maybe programming ?
written by HelpBot#8453
Alias jibberjabber
I am sorry, my english is not that good, and I sometimes have other problems,so my response might not be perfect.
N5RLX > "Jibber jabber ,all day and all night, jibber jabber jibber jabber"
jibberjabber
 
Posts: 119
Joined: 2016-01-10 16:58

Re: apache2 and python ?

Postby 1885 » 2018-09-29 17:32

got it thanks

viewforum.php?f=20
1885
 
Posts: 111
Joined: 2014-06-05 04:23

Re: apache2 and python ?

Postby GarryRicketson » 2018-09-29 20:54

I will give a couple of tips here, and also noticed the OP's report, I would move the topic, but us "spam hunters" are not supposed to do that, a moderator will need to. Of course if the moderators feel this is the appropriate board, then they will leave it here.

Any way, the tips (hints) are : To start simple, with a simple python script, like the one shown here:
https://www.linux.com/blog/configuring-apache2-run-python-scripts
part only : The first step, which in my PHP experience I never had to do, is not mentionned in the guides above is to enable CGI processing in apache.
Code: Select all
sudo a2enmod cgi


Further down, there is even a simple example python script:
Code: Select all
   #!/usr/bin/env python
    # -*- coding: UTF-8 -*-# enable debugging
    import cgitb
    cgitb.enable()    print("Content-Type: text/html;charset=utf-8")
    print()    print("Hello World!")

Once you have the website working and able to run a python script ( a simple one)
Then you are ready to start trying with more advanced scripts.

It is not clear if your server is even up and running, but for Debian, I suggest reading:
Some of the documentation specific to Debian
Code: Select all
/usr/share/doc/apache2/README

https://wiki.debian.org/Apache
Installing the "Mariadb", on Debian, is not very hard, either.
You should now have something to start with, but you do need to get "off the porch", and start learning to do more on your own.
User avatar
GarryRicketson
 
Posts: 5129
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: apache2 and python ?

Postby 1885 » 2018-09-30 03:29

Thanks GarryRicketson,

I've read this link and liked the content.
https://www.linux.com/blog/configuring- ... on-scripts

I've been using Apache for years and never bothered to look : /usr/share/doc/apache2/

I appreciate the help. I've written a lot of php with mariadb and would like to see how python works apache.
We are currently working with simple python web servers in our lab and have successfully implement a a scoring chroot base for fbctf that uses a simple python web server to post who has control of the base, (https://github.com/facebook/fbctf) . it's fun.
1885
 
Posts: 111
Joined: 2014-06-05 04:23

Re: apache2 and python ?

Postby debiman » 2018-09-30 09:58

^ a python server would not require apache2.

1885 wrote:I'm looking for a guide to run some python script using apache2

so this script does not include the server?
in any case, i find this description incredibly vague, i can't even begin to point out all that is missing here.

apparently the answer is "yes, this is possible", but it seems you dismissed that saying "i knew that already, please throw me more".
how about you throw us a bone first?
User avatar
debiman
 
Posts: 2900
Joined: 2013-03-12 07:18

Re: apache2 and python ?

Postby 1885 » 2018-09-30 13:08

debiman wrote:^ a python server would not require apache2.

apparently the answer is "yes, this is possible", but it seems you dismissed that saying "i knew that already, please throw me more".
how about you throw us a bone first?


I'm going to follow this path and try to run python script from a directory inside my apache2 document root.
I can run another python webserver on another port.

thanks
1885
 
Posts: 111
Joined: 2014-06-05 04:23

Re: apache2 and python ?

Postby debiman » 2018-10-01 05:57

1885 wrote:run python script from a directory inside my apache2 document root.

to what end?
talking about servers, i assume you want the result of the script to be served - somehow?
User avatar
debiman
 
Posts: 2900
Joined: 2013-03-12 07:18


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable