1

I have successfully deployed my django web application through Microsoft IIS FastCGI. So look wise my website seems to be fine. But after submitting the form on the website, i's showing nothing. It's like the submit button is not posting the form at all. But the same thing is running fine on the local server (not with the IIS deployed one).

In short, after deployment I am assuming that the index.html seems to be working fine but veiws.py or my JavaScript is not. I am not able to find find any solution for this. Any kind of help would be much appreciated.

For the reference, the main web.config is below.

web.config

<configuration>
  <system.webServer>
    <handlers>
      <add name="Python FastCGI"
           path="*"
           verb="*"
           modules="FastCgiModule"
           scriptProcessor="C:\Python\python.exe|C:\Python\Lib\site-packages\wfastcgi.py"
           resourceType="Unspecified"
           requireAccess="Script" />
    </handlers>
  </system.webServer>

  <appSettings>
    <!-- Required settings -->
    <add key="WSGI_HANDLER" value="my_app.wsgi_app()" />
    <add key="PYTHONPATH" value="C:\MyApp" />
    <add key="DJANGO_SETTINGS_MODULE" value="my_app.settings" />

    <!-- Optional settings -->
    <add key="WSGI_LOG" value="C:\Logs\my_app.log" />
    <add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
    <add key="APPINSIGHTS_INSTRUMENTATIONKEY" value="__instrumentation_key__" />    
    <add key="WSGI_PTVSD_SECRET" value="__secret_code__" />
    <add key="WSGI_PTVSD_ADDRESS" value="ipaddress:port" />
  </appSettings>
</configuration>

Console.log

console.log

urls.py

urls.py

Logs

#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-05-30 06:14:28
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-05-30 06:14:28 10.9.20.237 GET / - 90 - 10.156.68.147 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/102.0.0.0+Safari/537.36 - 200 0 0 978
2022-05-30 06:14:29 10.9.20.237 GET /static/AIG-Logo.png - 90 - 10.156.68.147 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/102.0.0.0+Safari/537.36 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 200 0 0 32
2022-05-30 06:14:29 10.9.20.237 GET /favicon.ico - 90 - 10.156.68.147 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/102.0.0.0+Safari/537.36 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 404 0 0 140
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-05-30 06:15:39
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-05-30 06:15:39 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 3
2022-05-30 06:15:39 10.9.20.237 GET /static/AIG-Logo.png - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 304 0 0 0
2022-05-30 06:15:39 10.9.20.237 GET /favicon.ico - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 404 0 0 2
2022-05-30 06:15:59 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 3
2022-05-30 06:16:01 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 3
2022-05-30 06:16:17 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 164
2022-05-30 06:17:50 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 1
2022-05-30 06:17:58 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 67
2022-05-30 06:19:01 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 2
2022-05-30 06:19:06 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 63
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-05-30 06:19:39
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-05-30 06:19:39 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 2
2022-05-30 06:19:44 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 65
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-05-30 06:20:32
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2022-05-30 06:20:32 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 4
2022-05-30 06:20:35 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 64
2022-05-30 06:22:51 10.9.20.237 GET / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 - 200 0 0 2
2022-05-30 06:23:04 10.9.20.237 POST / - 90 - 10.9.20.237 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.4951.64+Safari/537.36+Edg/101.0.1210.53 http://pwgsascs0597001.r1-core.r1.aig.net:90/ 500 0 0 100

views.py

LOGGING = {

'version': 1,

'disable_existing_loggers': False,

'formatters': {

'verbose': {

'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',

'style': '{',

},

'simple': {

'format': '{levelname} {message}',

'style': '{',

},

},



'loggers': {

'django': {

'propagate': True

},

'django.request': {

'level': 'ERROR',

'propagate': False,

},

'SSPR_Tool.custom': {

'level': 'INFO',

}

}

}
  • Did get any errors inside your browser console ? Check this post for IIS [logs](https://stackoverflow.com/questions/6426375/iis-where-can-i-find-the-iis-logs) – Ankit Tiwari May 29 '22 at 19:01
  • Error message is necessary to troubleshoot why post failed. If JS failed, error will show in console of browser. If JS success and python failed, IIS log will record the post request. Or you can enable failed request tracing to check if IIS receive post request and how it handle request. – Bruce Zhang May 30 '22 at 03:07
  • Hi @AnkitTiwari, I have updated my question with the information you asked. Kindly have a look and let me know what am I doing wrong. P.S- The same thing is working fine without any error while running it through local server without deployment. – Argha Kamal Chakraborty May 30 '22 at 06:31
  • Hi @BruceZhang, I have updated my question with the information you asked. Kindly have a look and let me know what am I doing wrong. P.S- The same thing is working fine without any error while running it through local server without deployment. – Argha Kamal Chakraborty May 30 '22 at 06:31
  • Hello @ArghaKamalChakraborty you're getting error from backend you can see 500 status in browser console try to checl IIS logs – Ankit Tiwari May 30 '22 at 06:39
  • Hello @AnkitTiwari, I have already provided the logs in the question. I don't know how to troubleshoot this issue. Would you help me? – Argha Kamal Chakraborty May 30 '22 at 06:45
  • @ArghaKamalChakraborty check this [post](https://stackoverflow.com/questions/65126982/how-can-i-show-error-logs-from-flask-running-on-iis) to setup error log for python application – Ankit Tiwari May 30 '22 at 06:55
  • @AnkitTiwari, I am working on Django not flask. I am not getting how to take the reference from flask and implement in django. Moreover, I believe that process will just let us know which error is occurring. But in this case we already got to know that it is a 500 error. Now I just need to figure out how to solve that which I am not able to do. – Argha Kamal Chakraborty May 30 '22 at 07:03
  • Hello @ArghaKamalChakraborty post which I've provided in that he is using python [logging](https://docs.python.org/3/howto/logging.html) you've to setup logging because in production you can't get actual error message by setting logging you get actual error message in file then it's easy to debug application also can look Django [logging](https://docs.djangoproject.com/en/4.0/topics/logging/) – Ankit Tiwari May 30 '22 at 07:42
  • Hi @AnkitTiwari, I have added the logging setup in my settings.py and it's showing me the error message now. I have updated the same in my question. Kindly have a look. – Argha Kamal Chakraborty May 30 '22 at 08:53
  • Inside your logging you've `'filters'` remove that if you don't have any custom filters or if you have one then replace project with your project name at this line `'project.logging.SpecialFilter'` you can read about [Filters](https://docs.djangoproject.com/en/4.0/topics/logging/#topic-logging-parts-filters) – Ankit Tiwari May 30 '22 at 08:58
  • @AnkitTiwari, I have removed all the unnecessary loggings and added the updated loggings in the question. The page successfully loaded. But then issue still persists. I am not able to see any error message on the web page after adding LOGGING but the error in the console log is still visible. Please guide me what to do next. – Argha Kamal Chakraborty May 30 '22 at 09:23
  • Did you see any updated logs inside your log file? try to read this post it will help you to [debug](https://stackify.com/beyond-iis-logs-find-failed-iis-asp-net-requests/) you code – Ankit Tiwari May 30 '22 at 09:44
  • @AnkitTiwari, I don't see any changes in logs. I think the problem is in the url section of fetch api. I have updated the image in my question highlighting the urls under console.log . The yellow highlighted part is the hostname on which I have deployed and now accessing the web page. Kindly have a look. – Argha Kamal Chakraborty May 30 '22 at 09:58
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/245170/discussion-between-argha-kamal-chakraborty-and-ankit-tiwari). – Argha Kamal Chakraborty May 30 '22 at 10:01
  • Why the function Fetch send form data to root url not any action under controller? Or did you set the application to accept post request to root url, not only get request? It more like that Fetch didnot send form to correct url. – Bruce Zhang May 31 '22 at 07:15

0 Answers0