jrreich / MEO_Analysis_HTML_Interface

HTML, CSS, JS, Flask and Python code to implement MEOLUT analysis
1 stars 1 forks source link

Rollout #4

Open jrreich opened 7 years ago

jrreich commented 7 years ago
  1. Install Python 2.7 - I recommend Anaconda as it comes with pip and other useful scientific/engineering modules

  2. Install Pip (if not bundled with the Python distribution)

  3. Install virtualenv In the packages.zip there is virtualenv-15.1.0-py2.py3-none-any.whl. Extract that somewhere and install using pip install virtualenv-15.1.0-py2.py3-none-any.whl

  4. Extract the zip file 'Rollout_Att1.zip' somewhere. Navigate to that folder (let's call this /webapp/root/ from here on. You might as well delete the entire folder named 'env' because we are about to build a new one from scratch.

  5. From the /webapp/root/ folder of above, make a virtualenv named 'env' (could be named anything) and activate it via command line.

virtualenv env env/Scripts/activate.bat

  1. Extract all needed packages somewhere ('/local/dir/' below) then use pip to install. Should be something like one of the following. Requirements.txt is in the /webapp/root/ folder extracted in step 4 above:
$ pip install -r requirements.txt --no-index --find-links=file:///local/dir/ 
$ pip install -r requirements.txt --no-index --find-links=/local/dir/ 
$ pip install -r requirements.txt --no-index --find-links=relative/dir/ 
  1. Extract the three folders in my-site-packages.zip into the directory env/Lib/site-packages that is created when you create a virtualenv name 'env' in step 5 above. So it should be /webapp/root/env/Lib/site-packages

  2. Install apache2.4 VC9 or 10... but might as well try it on VC14 if its already installed

  3. Install mod_wsgi

For python 2.7, apache 2.4, win x64, use VC10/VC9 - (Apache24-win64-VC10) > (mod_wsgi-py27-VC9.so) mod_wsgi-windows-4.4.12.tar.gz mod_wsgi-windows-4.4.12.tar.gz

Then move the appropriate module (see above -- mod_wsgi-py27-VC9.so) file to the modules folder and rename to just "mod_wsgi.so"

  1. Add the below to httpd.conf. You might also want to add a virtual host if this is going to be run through the same apache installation as other web apps. WSGIApplicationGroup %{GLOBAL} is need for numpy and pandas I think
## mod wsgi_
WSGIRestrictStdout Off #allows 'prints' to print to apache error log
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / C:\webapp\root\myapp.wsgi

DocumentRoot "C:\webapp\root"
<Directory C:\webapp\root>
    WSGIApplicationGroup %{GLOBAL}  
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Require all granted
</Directory>

Had to free up port 80 for apache to listen on by disabling the following services: Print Spooler SSDP Discovery SQL Server Reporting Services (MSSQLSERVER)

but may be others as well, use netstat -abno

to find the PID. If its 4, its a system process and difficult to find

  1. (Optional) Install as a windows service so it can start automatically using the follow from an elevate cmd prompt httpd.exe -k install -n "Apache2.4"

but that will be run as "system" and not a normal user, so a trusted connection using pypyodbc to your sql database may break. Just change the service to log in as the user that has sql db permissions.