I developed a python web app in flask and I'm trying to deploy it correctly on IIS.
Before i launch the app to production server I'm testing it on a VM.
All the steps i did:
Install IIS with CGI
With IIS installed, I download the web platform installer
I installed the WFastCGI for Python 3 (my version)
I configured the Handler Mappings and the CGI Settings to deploy my app, and is all fine.
The Website is all working, except one part. One of the functions of the website require execute a webdriver, in this case PhantomJS, with selenium python module.
The PhantomJS executable is on the root folder of the website:
PhantomJSPath = 'phantomjs/bin/phantomjs.exe'
But when i try to use declare the variable to select the webdriver his just don't run on IIS (when i open that specific page of that function it gives me a 500 ERROR, all the other pages work perfectly). The stupid thing is, when i execute by Flask development mode on port 5000 it just works perfectly.
browser = webdriver.PhantomJS(PhantomJSPath)
I tried a lot of stuff already like give all permissions to everyone on the web app folder and stuff like that. I think the problem is with IIS configuration or security settings.
I hope you can help me and all of the other people with the same issue ;) TY
Ok, i solved it. just configured the Website settings on IIS and Application pool to the specific path of the website, give all the permissions to the IIS user (IIS_USRS) and it works. Ty anyway!.
If you know any other ways to fix this issue just post. I Will mark if it works too.
Related
I'm developing a web application with flask for an acquaintance of mine, who will then host the website on a VPS. Since I don't want to give my source code as well, but only the service, is there a way to run it on the VPS without making the source code visible?
A website has been developed on a local ubuntu machine using python flask. The website runs fine on ubuntu at 127.0.0.1:5000. This website is supposed to go live on a godaddy server for which there is cpanel access. How to do it?
If it's a shared hosting solution, Answer to your question is NO, you can't do it. In a shared hosting environment Godaddy using only a PHP Stack. so you won't be able to use python there. Either go with VPS and configure your server. or go with a cloud service provider like Digital ocean, AWS, Linode etc.,
If your CPanel has the "Setup Python App" option (it's CloudLinux-based), you can try to deploy there.
I had a problem where only the root URL would work and all other routes returned 404.
Add the following to the top of your .htaccess file:
RewriteEngine on
RewriteRule ^http://%{HTTP_HOST}%{REQUEST_URI} [END,NE]
Got this info from: https://stackoverflow.com/a/63971427/10122266
Apologies that I couldn't add this as a comment as I do not have sufficient rights yet. But this solution worked for me and it would be a pitty if this little gem is hidden from those who may arrive here.
So would appreciate if this post is not deleted.
I would like to run my python application locally in any web browser. I am using PyCharm IDE for my Python apps but when i run app from IDE, its not running in browser. How it can solve?
Thanks.
you should run your code using server. there are many available. for example:
a link
your code will be triggered through demo_app in example from link above.
I have downloaded and installed python on my PC. I am learning python at this moment so I am a beginner.
Is there anyway I could execute python scripts in localhost (Apache) and view them in a web browser as we do with PHP? I am executing the python scripts from CLI at this moment.
Although there are multiple solutions, I would take a look at mod_python. Unfortunately, in my experience it is not the easiest thing in the world to set up and requires making changes to httpd.conf, but this tutorial is helpful (and gives some examples).
Google App Engine SDK for Python includes a local web server application that simulates the App Engine environment. It allows for instant server script changes by just saving the file and refreshing the browser.
The development tutorial is here
Once you have your web site working locally, it is easy to deploy it live on Google's App Engine servers.
I've downloaded google_appengine version 1.3.1. Using some web tutorials, I've created basic django 1.1.1 application. Using appcfg I managed to deploy it on GAE and it works. The problem is, that application doesn't want to work on dev_appengine.py developement server.
Whenever I run the app GAE local server is returning HTTP 200 without any content. If I set basic environement and run main.py manually, then the page is properly returned on stdout.
I've also created very basic helloworld application, and this one is working ok on the devel server.
Do you have any idea, how can I debug the devel server? Option -d doesn't give any usefull insight at all.
I had module nammed same way as the default GAE launcher (main/ and main.py). After renaming the launcher everything works great.