<div dir="auto">is Apache using a different config file when running as a service?<div dir="auto"><br></div><div dir="auto">could also be a file system permission issue?</div><div dir="auto"><br></div><div dir="auto">what account is the service running under?<br><br><div data-smartmail="gmail_signature" dir="auto"><br>__<br>Corey</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Aug 5, 2018, 10:31 PM CCP Dragonedge <<a href="mailto:ccp@drsb.com.my">ccp@drsb.com.my</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Sorry, it should be mod_wsgi 4.6.4, not 4.5.4</div><div>p<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 6 August 2018 at 10:27, CCP Dragonedge <span dir="ltr"><<a href="mailto:ccp@drsb.com.my" target="_blank" rel="noreferrer">ccp@drsb.com.my</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Unai,</div><div><br></div><div>Thanks for taking the time.</div><div><br></div><div>With regards to (1), I didn't see anything more meaningful. Inside my myapp.py, I do a "from module wfADM import wfUser". It just says it couldn't find module wfADM.</div><div><br></div><div>As for (2), before I installed mod_wsgi, I did test it out as a Windows service on a simple html file - no problems.</div><div><br></div><div>This is the entire scenario (sorry in advance for this long post):</div><div><br></div><div>Initially, I had Python 2.7, Flask, and MySQL 8 running on a Windows 7 box. This wasn't my development machine, it was going to be production, but I just wanted to make sure that everything worked, as I had never worked with Apache before. Then, I installed Apache 2.4 - pleasantly surprised that it was really easy. No problem as a Windows service, either (i.e. httpd -k install, then going into Services and starting it up).</div><div><br></div><div>So, apart from Apache, my production and development machines were basically identical. Therefore, I tried to install mod_wsgi on my DEVELOPMENT machine - and ran into all sorts of pain. After a very helpful exchange with the mod_wsgi boss, Graham Dumpleton, on Github (#347), my conclusion was that I had to use Python 3.6. After doing that (the only real change I had to make was changing MySQLdb to pymsql), I then managed to install mod_wsgi 4.5.4 (after much effort - I finally realized I had to install the latest Visual C++ compilers from Microsoft). Then, everything worked fine (now that I think of it, I didn't try to set up Apache as a Windows service on my development machine - I'll give that a shot when I have a bit more time).</div><div><br></div><div>Regardless, I basically did this on my PRODUCTION environment based on my experience on my development box:</div><div><br></div><div>0) Apache24 and MySQL 8 already installed, so I just left them<br></div><div>1) Uninstalled Python 2.7, which also gets rid of Flask</div><div>2) Installed Python 3.6</div><div>3) Installed Flask</div><div>   - tested my application on the Flask server; worked without any problems</div><div>4) Installed mod_wsgi</div><div>   - had to install the Visual C++ compilers, but after that, no issues</div><div>5) Set up the virtual host and the wsgi file, which leads to....<br></div><div><br></div><div>Current situation:</div><div>When I manually start up Apache by just typing httpd.exe on the command line, no problems accessing my Flask app from Apache. But when I try to set up Apache as a Windows service (httpd -k install, and then going to Services), I get the problem above (unable to see my modules).</div><div><br></div><div>Thanks for taking the time to read this!<br></div><div>p<br> </div><div><div class="m_7261205355059478391h5"><div class="gmail_extra"><br><div class="gmail_quote">On 6 August 2018 at 02:10, Unai Rodriguez <span dir="ltr"><<a href="mailto:unai@sysbible.org" target="_blank" rel="noreferrer">unai@sysbible.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>
<div name="messageBodySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif">Hi,
<div><br></div>
<div>(1) Is there any more specific error on Apache error logs?</div>
<div><br></div>
<div>(2) I’d make sure first Apache starts properly as a service. Can you test something else (perhaps a simple html page)  to make the Apache service is configured properly?</div>
<div><br></div>
<div>(3) If getting (1) and (2) did not help enough for you to figure it out, please submit exact steps on how yo configured Apache to start as a service and the Apache configuration for your Flask app</div>
<div><br></div>
<div>Thanks,</div>
<div>Unai Rodriguez</div>
</div>
<div name="messageReplySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><div><div class="m_7261205355059478391m_-3022882819119370644h5">On 5 Aug 2018, 14:31 +0200, CCP Dragonedge <<a href="mailto:ccp@drsb.com.my" target="_blank" rel="noreferrer">ccp@drsb.com.my</a>>, wrote:<br>
</div></div><blockquote type="cite" style="margin:5px 5px;padding-left:10px;border-left:thin solid #1abc9c"><div><div class="m_7261205355059478391m_-3022882819119370644h5">
<div dir="ltr">
<div>Hi,</div>
<div><br></div>
<div>I am deploying my Flask application on Apache24 using mod_wsgi 4.5.4 running on a Windows 7 machine. I have encountered something strange - when I start and stop Apache manually (i.e. by typing httpd.exe from the command line to start, and just hitting ctrl-C to stop), everything works fine.</div>
<div><br></div>
<div>When I, however, install Apache as a Windows service (by doing a "httpd -k install"; so it starts up when the machine is booted), I get a "500 internal server error" when I try to access my Flask application.</div>
<div><br></div>
<div>According to the error logs, Flask can't see my modules. I know it's something to do with Apache because when I just run the Flask server ("python myapp.py"), I have no problems.</div>
<div><br></div>
<div>Anyone experience this? If so, how did you overcome this? And I hope this isn't off-topic - if it is, sorry and please point me to the right place.</div>
<div><br></div>
<div>Thanks,</div>
<div>p<br></div>
</div></div></div>
_______________________________________________<br>
Flask mailing list<br>
<a href="mailto:Flask@python.org" target="_blank" rel="noreferrer">Flask@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/flask" target="_blank" rel="noreferrer">https://mail.python.org/mailman/listinfo/flask</a><br></blockquote>
<div></div>
</div>
</div>

</blockquote></div><br></div></div></div></div>
</blockquote></div><br><br></div></div>
_______________________________________________<br>
Flask mailing list<br>
<a href="mailto:Flask@python.org" target="_blank" rel="noreferrer">Flask@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/flask" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/flask</a><br>
</blockquote></div>