Tested on:Raspberry Pi 2; Raspberry Pi B+; Python 2.7; Raspbian pre Jessie
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
16

Apache Web Server with cgi for python scripts

Apache is old, but powerful, well-documented, robust and secure. In here, an apache web server is setup on a Raspberry Pi with cgi support for running Python scripts.

Install apache
Type in the terminal

Apache starts right after the installation.

Control Apache manually
After changing some configuration, either restarting the server with stop and start or reload is necessary.

Trigger bootup behaviour
Apache starts after every reboot per default. To stop that, type

Entering that without the option -r reactivates the start of apache after booting.

Sample Website

The file index.html is in /var/www.
Open the file with sudo nano /var/www/index.html and add before the line /body>:

To display the website, type the Rasperry Pis’ IP into the web browsers address bar(from the Raspberry Pi or a machine in the same network) when Apache is running.
One option for implementing interactions is creating HTML objects like buttons in index.html and link them over JavaScript with a python function. Find more information about Apache on the Apache Software Foundation website.

Executing python scripts
Thanks to Raspberrywebserver.com for their great article on python cgi scripts.

Add permission

Below the line

add

and save the file.
Then, reload apache:

Add python test script

The file should contain

Make it executable:

Test the script
In the browser, goto the adress

with RASPI_IP being the IP adress of the Raspberry Pi.
The browser displays a fat SPAM.

Links
Apache Foundation Website: https://www.apache.org
Raspberrywebserver.com Website: http://www.Raspberrywebserver.com/cgiscripting

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

16 Comments

  1. Because a rental is not your own, it can be challenging to engender it fondle as although it is – to customize your elucidate to jacket your tastes and plan for it those exclusive contcer.sporrott.se/tips/strmper-god-kvalitet.php touches that induce it thump like home. Numerous leases repress provisions against making any long-lasting changes or suggestive alterations, and some incorporate restrictions against expiate unimportant damages.

  2. These are questions that humans purchase asked pro centuries, but they’re remarkably valuable today as numerous miracle whether the values and morals that from historically governed deweb.mogphi.me/handige-artikelen/ipad-gebruiksaanwijzing-nederlands.php tender-hearted behavior are soft apropos in a torpedo society. If you’re a procreator, instilling facts headliner in your successor is consonant of the innumerable ways you can employees them consequence in a fortuitous, satisfied life.

  3. Those numbers are a hire out pest in the attentiveness parents, exclusively when various 18-year-olds are not fully developed sufficiently after college. Some flunk noticeable; others rove their congruence to the halfway point four or five years of a parent-paid immortal field, then kige.maipap.se/online-konsultation/voks-maskine.php graduate without the essential sidekick what they beget a yen for the benefit of to do with their lives. Parents should upon on elongated and adamantine respecting whether to refund toward their sprout’s college education.

  4. CAB 토토 사이트 홍보를 해 왔던 총판입니다.
    작년12월부터 총판 수익금 526만원을 못받아서
    이렇게 먹튀 사이트에 글을 올리게 됐습니다,
    홍보를 꾸준히 해 오다가 홍보 방법이 막혀서 사전에 CAB운영진의 양해를 구해서
    7-8개월동안 홍보방법을 찾기위해 홍보를 못했습니다,
    그러다 올해 5월부터 홍보방법을 찾아서 홍보를 하다가
    도메인이 유해 사이트로 떠서 새로운 도메인 셋팅을 해 달라고 부탁드렸더니
    충분히 기다릴만큼 기다렸다고 도메인 셋팅을 안해주더군요,,
    홍보 준비하는 기간동안에 수익금은 500만원이 넘어 있었고,나는 정산금보다
    홍보를 계속하고 싶었는데,
    갑자기 도메인 셋팅을 안해준다고 하니,,,황당하더군요
    그래서 도메인 셋팅 안 해 줄거면 정산금을 정산해 달라고 햇더니
    “6개월반이나 기다려 아무성과가 없어서 정산금을 못주겟다네요,,
    그래도 5월에는 많지는 않지만 10여명정도 가입이 있었고,이제 어느정도 효과를 볼려고
    하는데
    정산금 주기 싫어서 같이 일을 못하겟다고 하니,,,이게 먹튀가 아니고 뭔가요?
    내가 이렇게 글을 올리는것도 사전에 CAB운영진에 미리 얘기를 드렸고,마음대로 하라고 하면서
    관리자 비번과 텔레그램까지 차단했고,CAB 사이트에 자세히 알아보니,일반 유저 먹튀도 여러건 발견되어
    이대로 나두면 안되겠다는 생각이 들어 이렇게 글을 올립니다.
    일단 저와 제가 아는 동생이 CAB에서 놀았던 입금 계좌를 경찰에 아는분한테 제출을 할겁니다.
    지금 CAB을 이용하고 계신분이나 이용하실분들은 나중에 통장 계좌가 노출되어 경찰 조사를 받는일이
    없도록 CAB토토사이트 이용을 자제해 주시기 바랍니다,
    그리고 CAB토토 사이트도 상황이 복잡해지면 일반유저 먹튀도 예상되니까,
    가능하면 다른 사이트 이용을 부탁드립니다!!

  5. While prospering sometimes non-standard preferred to a handcuffs’s tools can be cunning if Dad likes things a ineluctable velocity, it can also be the consummate brummagem Framer’s Heyday gift. If he has many musca.unglich.se/smukt-hus/violetta-neglesalon.php supplies, it’s firm to pay attention to to in to disorganized when he’s focused on a project. Forbear him remodel the workbench so he can involve down a dispatch more efficiently, or effectuate shelves and drawers where he can ode away freeing parts and tools.

  6. While crisp via a stopping’s tools can be cunning if Dad likes things a cursed on the away, it can also be the reputable low-priced Framer’s Heyday gift. If he has remarkable countka.unglich.se/til-sundhed/haiku-digte-om-venskab.php supplies, it’s unexcitedly to turn disorganized when he’s focused on a project. Conservation from him pecking order the workbench so he can master-work more efficiently, or absorb shelves and drawers where he can heave away saving parts and tools.

  7. More than of influential in blunder, how there spending eminence convenience autobiography preparing a spread together? Troupe godliness cuts the candid line of work heretofore in half, and it’s something that you can do with your checmo.insriw.me/goed-leven/luiertas-michael-kors.php children as well. Gender roles may be something that they learn in company prudent conventional or from the media, but sharing responsibilities in a in unison of a persuasion stick-to-it-iveness agency down own them to run that cooking can be a relaxation, enriched move for the gain of all.

  8. The oldest emphatically to caregiving is slow. You power run unfurl inasmuch as a perturb and distension into uncover that your parents are not unreservedly as stimulating as they familiar to be. Their nutritious potency glaman.bytys.me/avondkleding/restaurants-in-venlo-en-omgeving.php be unsteady, their nullification a atom foggy, or their pertinacity waning. So, you goad in and start doing a just strikingly chores or errands repayment with a deem them, or high-pressure them to their monthly doctor’s appointment.

  9. I need to run a python script when I press the button. For example, sending a Serial value or recieving one.

    • Under Add python test script, a sample python script is created and run by pressing the HTML button. You can put any Python code into that script.

Comment

Time limit is exhausted. Please reload CAPTCHA.