cgi fuer python funktioniert nicht

Django, Flask, Bottle, WSGI, CGI…
Antworten
mit
User
Beiträge: 285
Registriert: Dienstag 16. September 2008, 10:00

Hi,
Ich habe diese Web Anwendung https://github.com/nthomasCUBE/RNASeqExpressionBrowser gefunden und ich habe diese installation Anleitung https://www.youtube.com/watch?v=rTFIUnZDca8 befolgt und versucht diesen service mithilfe von docker-compose zum laufen zu bringen, aber leider funktioniert es nicht.

docker-compose.yml:

Code: Alles auswählen

version: '3'
services:
  expressionbrowser:
      build: .
      restart: always
      ports:
          - "80:80"
      depends_on:
          - expressionbrowserdb
      volumes:
          - ./data/:/db

  expressionbrowserdb:
    image: mariadb
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=admin
      - MYSQL_DATABASE=expressionbrowser
      - MYSQL_USER=browseradmin
      - MYSQL_PASSWORD=password
    ports:
      - "3306:3306"
    volumes:
      - ./mysql/:/docker-entrypoint-initdb.d

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    restart: always
    depends_on:
      - expressionbrowserdb
    ports:
      - 8183:80
    environment:
      PMA_USER: root
      PMA_PASSWORD: admin
      PMA_ARBITRARY: 1

mysql/rna.sql

Code: Alles auswählen

CREATE DATABASE IF NOT EXISTS expressionbrowser;
CREATE USER 'browseradmin'@'localhost';
SET PASSWORD FOR 'browseradmin'@'localhost' = PASSWORD('password');
CREATE SCHEMA expressionbrowser;
GRANT ALL PRIVILEGES on expressionbrowser.* TO 'browseradmin'@'localhost';

Dockerfile:

Code: Alles auswählen

FROM debian:stretch-backports
RUN apt-get update  && apt-get install -y --no-install-recommends \
    build-essential \
    apache2 \
    python-dev \
    python-setuptools \
    python-numpy \
    python-mysqldb \
    python-pip \
    python-wheel \
    git wget unzip \
    ncbi-blast+ && \
    apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


#Based on: https://github.com/eriston/Apache-with-python-cgi-Docker
#load apache cgi module
RUN a2enmod cgi
RUN service apache2 restart

#enable cgi in the website root
#second block to allow .htaccess
RUN echo "                       \n \
<Directory /var/www/html>        \n \
   Options +ExecCGI              \n \
   AddHandler cgi-script .py     \n \
   DirectoryIndex index.py       \n \
</Directory>                     \n \
" >> /etc/apache2/apache2.conf

RUN chmod -R u+rwx,g+x,o+x /var/www/html

RUN pip install fisher goatools

RUN git clone https://github.com/nthomasCUBE/RNASeqExpressionBrowser.git
RUN example/example.zip 

RUN cd RNASeqExpressionBrowser && \
    sed -i.bak "s|mysql_host::server|mysql_host::expressionbrowserdb|" installation_example.conf && \
    sed -i.bak "s|mysql_db::db|mysql_db::expressionbrowser|" installation_example.conf && \
    sed -i.bak "s|mysql_user::user|mysql_user::browseradmin|" installation_example.conf && \
    sed -i.bak 's|raw_input(">Please specify the absolute path to the directory where CSS file should be stored (within the /var/www/html directory, directory must exist) e.g. \[/var/www/html\]\\n") or my_input;|"/usr/lib/cgi-bin"|' installation.py && \
    sed -i.bak 's|raw_input(">Please specify the absolute path to the directory of the web server location, somewhere under e.g. \[/var/www/cgi-bin OR /usr/lib/cgi-bin\]\\n")|"/var/www/html"|' installation.py && \
    sed -i.bak 's|raw_input(">Please provide the path to the directory where R-output can be stored and accessed by apache-user e.g. \[/nfs/plantsp/webblast/data/\]\n")|"/data/webblast"|' installation.py #&& \
    #python installation.py installation_example.conf

EXPOSE 80
CMD /usr/sbin/apache2ctl -D FOREGROUND

Vielen Dank im Voraus
Sirius3
User
Beiträge: 17710
Registriert: Sonntag 21. Oktober 2012, 17:20

Es sieht so aus, als ob jemand ein PHP-Skript 1:1 in ein Python-Skript umgewandelt hat.

@mit: was erwartest Du jetzt?? dass irgendwer sich das Video anschaut und auch versucht, das was Du gemacht hast, zu erraten, um vielleicht beim selben Fehler zu landen, den wir nicht kennen?

Daher: was hast Du genau gemacht, welche Meldungen und Fehlermeldungen erscheinen?
Benutzeravatar
noisefloor
User
Beiträge: 3843
Registriert: Mittwoch 17. Oktober 2007, 21:40
Wohnort: WW
Kontaktdaten:

Hallo,

IMHO ist der Code so wie so nicht lauffähig. https://github.com/nthomasCUBE/RNASeqEx ... /index.cgi hat zumindest nach der Darstellung bei Github Einrückungsfehler.

Warum jemand 2017 noch eine CGI-Webanwendung schreibt muss man auch nicht verstehen...

Gruß, noisefloor
Benutzeravatar
__blackjack__
User
Beiträge: 13003
Registriert: Samstag 2. Juni 2018, 10:21
Wohnort: 127.0.0.1
Kontaktdaten:

@noisefloor: Könnte sein das es trotzdem funktioniert, denn wenn man sich die Einrückung da genauer anschaut, stellt man fest, das es Tabs und/oder Leerzeichen sind.

Der Quelltext ist grundsätzlich aber streckenweise mehr als gruselig. Nicht nur wegen der verwendeten, nicht mehr zeitgemässen Technik (CGI), sondern sowohl was „unpythonischen“ Code angeht, als auch Programmierpraktiken allgemein. Das ist kein Python-Programm und teilweise eben nicht einmal ein gutes Programm in irgendeiner anderen Programmiersprache.
“Most people find the concept of programming obvious, but the doing impossible.” — Alan J. Perlis
Antworten