Deploying web2py app on Google App Engine - python

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

Related

Problem facing while deploying Streamlit app

I am developing a Streamlit web app (using Python). While deploying my web app on Streamlit cloud, a strange error is shown on the screen telling me:
:exclamation: Updating the app files has failed: open /home/appuser/.ssh/id_github: no such file or directory
The log image is here:
I do not understand why it gives me this type of error when I don’t have these files or folders in my local app folder.
This happens if your GitHub SSH keys have expired. If you unlink your Streamlit Cloud account from GitHub, then re-link them, that should resolve the issue.

deploy first django test app to anywhere (azure or heroku)

tldr; - When I have deployed a flask app in the past, it uses a requirements.txt file in the main root of the project folder so that azure or heroku can understand what modules need to be installed. However, this is the first time I am messing with django. I am trying to test deploy to azure or heroku but I azure can't detect the stack of the app because there is no requirements.txt file in the main root of the folder.
From messing with django a little bit, it seems alot more complicated than flask. What can I do to test deploy the most basic app to azure app services or heroku or aws or any place in general?
I tried deploying the django app like I normally do with flask but received an error:
Could not auto-detect the runtime stack of your app.
HINT: Are you in the right folder?
For more information, see 'https://go.microsoft.com/fwlink/?linkid=2109470'
Here is a picture of what I am seeing on my side:
I would assume I am not in the right folder but I am not sure if that is the problem completely.
Here is app I am testing myself. Its a microsoft authenication test app where you can test your xbox live account, microsoft school account, or microsoft work account against the webpage: https://github.com/Azure-Samples/ms-identity-python-django-tutorial
**Of course I added the app registration information from azure. Infact, the same app registration information works on my flask app so any azure app registrations issues is probably not the issue. **
The repo you link contains multiple projects. It sounds like you need to clone this, then move one of the project sub-directories (which should have its own requirements.txt already) into a fresh working tree, initialize a new repo there, and then push that to the cloud provider.

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).

Noob questions about upload & security

I have the myapp.py and app.yaml in my windows C:\myap directory. The docs say to use:
appcfg.py update myapp/
to upload the app.
I've downloaded/installed Python and the Google python kit.
Sorry, for these noobish questions, but:
Is the myapp/ listed above refer to c:\myapp on my windows machine? Or is it the name of my app on the google side?
How/where do I type the appcfg.py to upload my directory?
Are there any security issues associated with using my gmail account and email address?
I'd like anybody from Second Life to be able to call this from in-world. There will be about a dozen calls a week. Are they going to have to authenticate with my email/password to use it?
Thanks for any help you can provide!
Since you have app in C:\myap you need to run appcfg.py update C:\myap. It's just a path to you app on your machine.
In windows command line. For example, "C:\Program Files (x86)\Google\google_appengine\appcfg.py" update C:\myap
No, appcfg uses SSL while uploading. It's safe.
If you mean to call application uploading - it's not really safe. I don't know why you need this. You can add app developers in App Engine admin console, so they will be able to deploy application from their accounts.

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