I'm trying to publish a Django web application (created with Python 2.7.15
) via IIS. First of all I installed the application:
:: setup folders
mkdir C:\Software\MyApp\
cd C:\Software\MyApp\
:: clone the git Repository
git clone https://gitlab.com/blablabla.git C:\Software\MyApp\MyAppServer
:: create the virtualenv
python -m pip install --upgrade pip
pip install virtualenv
virtualenv py2_env
call py2_env\Scripts\activate.bat
:: install the python-requirements in the virtualenv
pip install -r C:\Software\MyApp\MyAppServer\requirements.txt
:: copy all static files in C:\var\www
python C:\Software\MyApp\MyAppServer\manage.py collectstatic
:: just to check if the app works (and it works!)
python C:\Software\MyApp\MyAppServer\manage.py runserver
At this point, my folders organization is:
C:\
└── Software\
└── MyApp\
├── py2_env\
│ ├── Include\
│ ├── Lib\
│ ├── Scripts\
│ └── tcl\
└── MyAppServer\
├── manage.py
├── ...
└── myapp_django_server\
├── urls.py
├── wsgi.py
└── ...
And the packages installed in my py2_env
virtual env are:
(py2_env) C:\Software\MyApp\py2_env\Scripts>pip freeze --local
Django==1.11.2
djangorestframework==3.6.3
numpy==1.12.1
pytz==2018.7
wfastcgi==3.0.0
At this point I configure IIS following this guide (I jumped to the Configure IIS to Serve Django Applications chapter) but, at the end, if I browse to http://localhost:81 I get this error:
Error occurred:
Traceback (most recent call last):
File "C:\Software\EVARplanning\py2_env\Lib\site-packages\wfastcgi.py", line 847, in main
result = handler(record.params, response.start)
TypeError: get_wsgi_application() takes no arguments (2 given)
StdOut:
StdErr:
Can anyone tell me what's wrong?
The problem was in my WSGI_HANDLER
in the IIS's FastCGI Settings
. I converted it's value from django.core.wsgi.get_wsgi_application
to django.core.wsgi.get_wsgi_application()
and then it works.