Flask webapp deployed on IIS does not serve network folder files - python

Firstly this is my debut query on stack overflow , hope i have maintained the required protocols.
Have a flask app running on Windows 2012.
I have a simple flask app which serves local and network files (.pdf,.csv). When i run the flask app thru' terminal it is able to serve both Local and network files when the embedded url is clicked .The files open in a new tab.
But when i launch it thru IIS, it is only able to serve local files and throws access denied messages[Error 13] whenever the network file url is clicked
Have been breaking my head over it.
Any help is appreciated.

Trying to change the identity to Network Service.

Related

Python - open specific url on local machine from app on remote host

I packaged a python streamlit app on Azure App Service. A button of the app wants to point to an external PowerBI dashboard.
What I want to achieve is to make the button (in the app running on App Service, so on a remote host) open a new tab or browser window on the local machine from which the remote app is accessed.
I think the right way to do this is to use the webbrowser.open_new_tab() function, but I can't understand how to exactly use this.
The url that I need to open from within the app is in the form https://app.powerbi.com/links/....
This is a related question that shares a similar setting, but I think that the goal there is not exactly the same, because I do not want to access some service on my local machine (deduced from the url that points to <ip-localhost>:8080), but I just want to open a new internet page on my local machine.

make flask application work for certain perio similar to trail software

I'm currently developing flask application for a client and i want to give him/her to test it in there local machine. Issue is that i don't have internet connect or remote access in their system so I'm forced to add all source code i did to their system. i want to know is there a way i can give the client flask application without providing him/her with source code.
My objective is to make source code hidden of flask application whether it by executable file or have 30days for testing and after 30days application will automatically be deleted or disabled from their system it similar how trial application work.
If anyone can guide me into how can i make source code of flask hidden from client when i don't have any access to PC or internet that flask application is installed in

Flask app doesn't builds on MS Azure cloud

I want to deploy my flask web application on Azure cloud. In Deployment options, I have selected GitHub as source destination for my flask code. after doing the configuration test successfully, the init.py file now starts building;
Now when I go to my application link, it shows me this;
Now at this point, I went back to my deployment options, it says Building failed;
the log generated for this building failed can be seen in the first picture. All the tests has passed except the last one "Performance test". Have anyone encountered the same issue before ? what can be the reason for that ?
I am running the application on localhost # port 8000.
from flask import Flask
app = Flask(__name__)
#app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
Do I need to run it on another IP ?
You cannot listen on port 8000 in Web Apps. Only port 80 or 443. You'll need to read the port number from the environment, to know what to listen on.
If you created the Azure Webapp using the Flask tool, the default app is called FlaskWebProject1. If your app has a different name, you need to modify web.config in your wwwroot folder to reflect the correct app name.
Then redeploy using the Azure portal or change it in your GIT and push again.
Based on your 500 error, I think some python packages are not installed correctly.
To check your code is working correctly in naive manner, do as follows.
If you are developing on Windows machine, copy all of your site-packages files in development machine to WebApp /site/wwwroot/env/Lib/site-packages folder.
Hit Restart in Azure Portal and F5 in browser.
If it works, your deployment process might have a problem. Mainly it is caused by library installation.
First, check you have requirements.txt at the root folder. This documentation describes some considerations to load Flask on Azure WebApp. Of course, it would be really helpful to read the documentation from the first line carefully.
Second, login WebApp via FTP and check the package is installed correctly. You can see /pip folder has pip.log file, and /site/wwwroot/env/Lib/site-packages folder has its libraries.
For some libraries which you might require more than simple hello world app, you may have to push x86 .whl files along with python codes as they are not installed correctly in x86 environment.
Additionally, in order to show internal error to outside, consider to apply this option during development (not for production).

Deploying web2py app on Google App Engine

I'm tring to hosped my web2py app on GAE, but I'm not having success. I copied the web2py\example\app.example.yaml to web2py\app.yaml and the queue.yaml too. I edited the line application of the first file cited. I downloaded the web2py_src and the GAE luncher for windows, then I created a account on GAE, where my app is named 'topranchos'. The I added the app on GAE, ran one time and clicked in Deploy. It showed that the files was updated on server.
Then, when I try to access http://topranchos.appspot.com , the server raise HTTP 500 error.
How can I solve it?
The link to image of console from GAE dashboard is here: http://i.stack.imgur.com/TAXoq.png
I solved this problem moving the handlers/gaehandler.py to web2py root path. Thank you

Distributing a local Flask app

I've made a simple Flask app which is essentially a wrapper around sqlite3. It basically runs the dev server locally and you can access the interface from a web browser. At present, it functions exactly as it should.
I need to run it on a computer operated by someone with less-than-advanced computing skills. I could install Python on the computer, and then run my .py file, but I am uncomfortable with the files involved being "out in the open". Is there a way I can put this app into an executable file? I've attempted to use both py2exe and cx_freeze, but both of those raised an ImportError on "image". I also tried zipping the file (__main__.py and all that) but was greeted with 500 errors attempting to run the file (I am assuming that the file couldn't access the templates for some reason.)
How can I deploy this Flask app as an executable?
Host it.
Since you created it in Flask, and its a web app - hosting it should be trivial. Dump it on any of the PaaS providers like Heroku, Google App Engine, OpenShift or spin up a micro instance on EC2 and host it there.
Creating an executable is not the solution.
Why distribute it at all? If the user you want to use it is on the same local network as the Flask application, just give them the IP address and they can access it via a browser just as you are doing, and no access to the source code either!

Categories

Resources