2016-07-04 6 views
0

소개

가상 Environement에 mod_wsgi에 설치하는 방법. 터미널에서 웹 API를 실행할 때 코드가 잘 실행되고 코드의 다음 줄에서 호스트됩니다.나는 웹 API는 파이썬 3 writtten하고 플라스크를 사용하여이

if __name__ == '__main__': 
    app.run(host='', port=8010, debug='true') 

현황

코드는 완벽하게 실행하고 나는 아파치 서버에 그것을 설정합니다. 그러나 아파치 서버는 이미 파이썬 2를 사용하여 빌드되었고 파이썬 2에 mod_wsgi가 필요한 웹 사이트를 이미 가지고 있습니다.

아파치 서버에서 mod-wsgi를 설정하는 방법이 있다면 다음을 보았습니다. 내가 가상 환경 모드 - WSGI를 설치하기 위해 노력하고있어 솔루션

에서하지 mod_wsgi for Python 2 as well as Python 3 on one Apache server

시도 할 수 있습니다. 여기에서 패키지를 다운로드하고 패키지를 활성화 한 후 환경에 설치하려고했습니다.

나는 터미널에서 sudo python setup.py install를 실행하지만 난 그래서 내가 읽어보기는 그 압축 된 패키지의 일부 파일을 열

File "setup.py", line 139, in 'missing Apache httpd server packages.' % APXS) RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.

아래의 오류가 발생했습니다 및 기능은 다음

If you wish to use a version of Apache which is installed into a non standard location, you can set and export the APXS environment variable to the location of the Apache apxs script for your Apache installation before performing the installation.

Note that nothing will be copied into your Apache installation at this point. As a result, you do not need to run this as the root user unless installing it into a site wide Python installation rather than a Python virtual environment.

To verify that the installation was successful, run the mod_wsgi-express script with the start-server command::

mod_wsgi-express start-server 

그것은 보인다 발견 아파치가 내가 명령을 실행하고있는 가상 환경에 설치되지 않았기 때문에 나의 상황에 대처할 수있다. 그러나 어떻게 해야할지 모른다.

나는 presu 그들은 setup.py 파일에 대해 이야기하고 있으며 경로를 변경해야하지만 구문을 현명하게하거나 APXS 스크립트가있는 위치를 알지 못합니다. 여기

APXS = os.environ.get('APXS') 

WITH_HTTPD_PACKAGE = False 

if APXS is None: 
    APXS = find_program(['mod_wsgi-apxs'], 
      paths=[os.path.dirname(sys.executable)]) 
    if APXS is not None: 
     WITH_HTTPD_PACKAGE = True 

if APXS is None: 
    APXS = find_program(['mod_wsgi-apxs', 'apxs2', 'apxs'], 
      'apxs', ['/usr/sbin', os.getcwd()]) 
elif not os.path.isabs(APXS): 
    APXS = find_program([APXS], APXS, ['/usr/sbin', os.getcwd()]) 

if not WITH_TARBALL_PACKAGE: 
    if not os.path.isabs(APXS) or not os.access(APXS, os.X_OK): 
     raise RuntimeError('The %r command appears not to be installed or ' 
       'is not executable. Please check the list of prerequisites ' 
       'in the documentation for this package and install any ' 
       'missing Apache httpd server packages.' % APXS) 

을 수정해야 할 내가 필요를 생각하는 코드의 조각이다 질문 내가 도움이된다면 우분투 12.04LTS를 실행하는 서버에이 모든 일을 해요

. 마지막에 내 질문은 내가 코드를 변경하려면 어떻게

  • 사용

  • 을 주셔서 너무 감사 거기 APXS 스크립트 만들기 위해 APXS 우분투에 일반적으로 위치

    1. 를 따르고 있습니다 불편

      에 대한

    +0

    오해 죄송합니다. 내 APACHE에 APXS가 설치되지 않았습니다. –

    답변

    1

    죄송합니다 귀하의 시간을 내 아파치 서버에 APXS를 설치하는 것을 잊었다 밝혀졌습니다. 간단히 말하면 터미널에서 코드를 실행하고 작동했습니다. sudo apt-get apache2-threaded-dev