apache - How to Install mod_wsgi in a virtual Environement -
introduction
i have web api writtten in python 3 , uses flask. code runs fine when run web api terminal , hosted following line in code.
if __name__ == '__main__': app.run(host='', port=8010, debug='true')
current situation
the code runs , want set on apache server. apache server has websites built using python 2 , need mod_wsgi python 2.
i looked if there way set both mod-wsgi on apache server according following source can't mod_wsgi python 2 python 3 on 1 apache server
attempt @ solution
i 'm trying install mod-wsgi virtual environment. downloaded package here , tried install environment after activating it.
i ran sudo python setup.py install
terminal got error below
file "setup.py", line 139, in 'missing apache httpd server packages.' % apxs) runtimeerror: 'apxs' command appears not installed or not executable. please check list of prerequisites in documentation package , install missing apache httpd server packages.
so opened read me file part of zipped package , found following
if wish use version of apache installed non standard location, can set , export
apxs
environment variable location of apacheapxs
script apache installation before performing installation.note nothing copied apache installation @ point. result, not need run root user unless installing site wide python installation rather python virtual environment.
to verify installation successful, run
mod_wsgi-express
scriptstart-server
command::mod_wsgi-express start-server
it seems tackle situation since apache not installed in virtual environment i'm running command have no idea how
i presume talking setup.py file , should change path not know how syntax wise or apxs script located.
here snippet of code think needs modified
apxs = os.environ.get('apxs') with_httpd_package = false if apxs none: apxs = find_program(['mod_wsgi-apxs'], paths=[os.path.dirname(sys.executable)]) if apxs not none: with_httpd_package = true if apxs 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 installed or ' 'is not executable. please check list of prerequisites ' 'in documentation package , install ' 'missing apache httpd server packages.' % apxs)
the question
i'm doing of on server running ubuntu 12.04lts if helps. question @ end following
- where apxs located in ubuntu
- how change code snippet make use apxs script there
thank time
sorry inconvenience
turns out forgot install apxs on apache server. ran code terminal , worked sudo apt-get apache2-threaded-dev
Comments
Post a Comment