Setting up Flask on IIS
Revision as of 20:22, 3 August 2017 by PeterHarding (talk | contribs)
From scratch on PROCYON
Image of Console
- Check that I have FastCGI Installed. If not - install it.
- Add the new web site
- Check Basic Settings
- Setup FastCGI
- Go to Handler Mappings
- Add Module Mapping
- Need to go to Top of Connections Pane - and select FastCGI Settings - (double click on Icon). Then burrow down into Environment Variables and add:
PYTHONPATH C:\www\sites\flask WSGI_HANDLER server.app
Setup the Flask application tree.
(Make up a model)
Python Setup
C:\Users\plh>python --version Python 2.7.13 C:\Users\plh> C:\Users\plh>ipip install wfastcgi 'ipip' is not recognized as an internal or external command, operable program or batch file. C:\Users\plh>pip install wfastcgi Collecting wfastcgi Downloading wfastcgi-3.0.0.tar.gz Installing collected packages: wfastcgi Running setup.py install for wfastcgi ... done Successfully installed wfastcgi-3.0.0 C:\Users\plh>pip install wfastcgi Requirement already satisfied: wfastcgi in c:\apps\python27_64\lib\site-packages C:\Users\plh>pip install Flask Collecting Flask Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB) 100% |################################| 92kB 921kB/s Collecting itsdangerous>=0.21 (from Flask) Downloading itsdangerous-0.24.tar.gz (46kB) 100% |################################| 51kB 1.1MB/s Collecting click>=2.0 (from Flask) Downloading click-6.7-py2.py3-none-any.whl (71kB) 100% |################################| 71kB 1.5MB/s Collecting Werkzeug>=0.7 (from Flask) Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB) 100% |################################| 317kB 930kB/s Collecting Jinja2>=2.4 (from Flask) Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB) 100% |################################| 348kB 1.1MB/s Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask) Downloading MarkupSafe-1.0.tar.gz Installing collected packages: itsdangerous, click, Werkzeug, MarkupSafe, Jinja2, Flask Running setup.py install for itsdangerous ... done Running setup.py install for MarkupSafe ... done Successfully installed Flask-0.12.2 Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 itsdangerous-0.24 C:\Users\plh>
C:\Users\plh>pip install sqlalchemy Collecting sqlalchemy Downloading SQLAlchemy-1.1.12.tar.gz (5.2MB) 100% |################################| 5.2MB 212kB/s Installing collected packages: sqlalchemy Running setup.py install for sqlalchemy ... done Successfully installed sqlalchemy-1.1.12 C:\Users\plh>pip install flask-sqlalchemy Collecting flask-sqlalchemy Downloading Flask_SQLAlchemy-2.2-py2.py3-none-any.whl Requirement already satisfied: SQLAlchemy>=0.8.0 in c:\apps\python27_64\lib\site-packages (from flask-sqlalchemy) Requirement already satisfied: Flask>=0.10 in c:\apps\python27_64\lib\site-packages (from flask-sqlalchemy) Requirement already satisfied: itsdangerous>=0.21 in c:\apps\python27_64\lib\site-packages (from Flask>=0.10->flask-sqlalchemy) Requirement already satisfied: click>=2.0 in c:\apps\python27_64\lib\site-packages (from Flask>=0.10->flask-sqlalchemy) Requirement already satisfied: Werkzeug>=0.7 in c:\apps\python27_64\lib\site-packages (from Flask>=0.10->flask-sqlalchemy) Requirement already satisfied: Jinja2>=2.4 in c:\apps\python27_64\lib\site-packages (from Flask>=0.10->flask-sqlalchemy) Requirement already satisfied: MarkupSafe>=0.23 in c:\apps\python27_64\lib\site-packages (from Jinja2>=2.4->Flask>=0.10->flask-sqlalchemy) Installing collected packages: flask-sqlalchemy Successfully installed flask-sqlalchemy-2.2 C:\Users\plh> C:\Users\plh>cd \www C:\www>cd sites C:\www\sites>cd flask C:\www\sites\flask>python server.py Traceback (most recent call last): File "server.py", line 9, in <module> from flaskapp import app File "/www/sites/flask\flaskapp\__init__.py", line 17, in <module> from trace import Trace File "/www/sites/flask\flaskapp\trace.py", line 7, in <module> import pytz ImportError: No module named pytz C:\www\sites\flask>pip install pytz Collecting pytz Downloading pytz-2017.2-py2.py3-none-any.whl (484kB) 100% |################################| 491kB 957kB/s Installing collected packages: pytz Successfully installed pytz-2017.2 C:\www\sites\flask>python server.py Traceback (most recent call last): File "server.py", line 9, in <module> from flaskapp import app File "/www/sites/flask\flaskapp\__init__.py", line 51, in <module> from . import routes, models File "/www/sites/flask\flaskapp\routes.py", line 8, in <module> import requests ImportError: No module named requests C:\www\sites\flask>pip install requests Collecting requests Downloading requests-2.18.3-py2.py3-none-any.whl (88kB) 100% |################################| 92kB 1.1MB/s Collecting idna<2.6,>=2.5 (from requests) Downloading idna-2.5-py2.py3-none-any.whl (55kB) 100% |################################| 61kB 1.4MB/s Collecting chardet<3.1.0,>=3.0.2 (from requests) Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB) 100% |################################| 143kB 1.3MB/s Collecting certifi>=2017.4.17 (from requests) Downloading certifi-2017.7.27.1-py2.py3-none-any.whl (349kB) 100% |################################| 358kB 1.1MB/s Collecting urllib3<1.23,>=1.21.1 (from requests) Downloading urllib3-1.22-py2.py3-none-any.whl (132kB) 100% |################################| 133kB 975kB/s Installing collected packages: idna, chardet, certifi, urllib3, requests Successfully installed certifi-2017.7.27.1 chardet-3.0.4 idna-2.5 requests-2.18.3 urllib3-1.22 C:\www\sites\flask>python server.py Traceback (most recent call last): File "server.py", line 9, in <module> from flaskapp import app File "/www/sites/flask\flaskapp\__init__.py", line 51, in <module> from . import routes, models File "/www/sites/flask\flaskapp\routes.py", line 27, in <module> from models import \ File "/www/sites/flask\flaskapp\models.py", line 6, in <module> from dateutil import parser as datetime_parser ImportError: No module named dateutil C:\www\sites\flask>pip install dateutil Collecting dateutil Could not find a version that satisfies the requirement dateutil (from versions: ) No matching distribution found for dateutil C:\www\sites\flask>pip install python-dateutil Collecting python-dateutil Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB) 100% |################################| 194kB 1.1MB/s Collecting six>=1.5 (from python-dateutil) Downloading six-1.10.0-py2.py3-none-any.whl Installing collected packages: six, python-dateutil Successfully installed python-dateutil-2.6.1 six-1.10.0 C:\www\sites\flask>python server.py * Restarting with stat * Debugger is active! * Debugger PIN: 180-289-821 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\
OK. It's now working!