Noob questions about upload & security - python

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.

Related

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

Django: Push app from local server to production server via FTP

This is a bit embarassing, but I'm a Django noob and I couldn't find a simple solution to this:
I have written a Django app in a local VM that I now want to deploy to a "production" server. App works like a charm locally.
Now my IT colleague has set up the server with Django and that also works fine. I can open it via the Web and I get the usual "Congratulations on your first Django-powered page". I can also log into the admin interface. The project has been created.
This is a very low-key mini project and I'm not too familiar with git, so we've decided to just push files via FTP. (And I want to stick with that if at all possible.) So I uploaded the app folder into the project folder and also adjusted the project's settings.py and urls.py.
However, nothing seems to be happening on the server's end. The welcome page is the same, the app does not show up in the admin interface and the URLs won't be resolved as hoped.
Any suggestions what I should have done / done differently?
You need to restart apache or whatever is running your django project. Your changes to py files are cached when you first load your server config (settings).
Any suggestions what I should have done / done differently?
You should be using git/jenkins/deployment techniques, I know you said you've decided not to use it but you're going to be missing out on important things like being able to keep track of changes and unit testing

Working locally on web-application

I have been added as developer on application.
On Applications Overview this app is shown together with my other app, that I can freely access and change via Google App Engine Launcher.
Question is how to get app I'm supposed to work on my computer locally(in other words in GAE), so I can test and change it locally in the browser on my computer...
Windows 7
App Engine SDK-release: "1.7.6"
API: python27
You can use the appcfg application (the one that handle uploads) to download the source code.
This only works if the administrator has not disabled it.
However, it would be better to ask the developpers to provide you with the original source code !

How to set up auto-deploy to AppEngine when pushing to Git Repository

I've heard that other platforms support auto-deployment of their code to production when they push changes to their Git repository.
Can I set up something similar to this for AppEngine? How?
I'm using Python2.7 on Windows, and bitbucket as a repository.
Thanks!
Since app engine deploy is just a python script, why can't you just write a shell script that calls 'git push' followed by 'python appcfg.py deploy'?
Any bitbucket hooks that will send from bitbucket->appengine after you upload to app is probably a bad idea since it will require storing your app engine login credentials on github.
Other projects might have your app server pull from github/bitbucket. You can do this if your app engine site just serves static websites using http://drydrop.binaryage.com/, but you can't update actual running code this way.
Recently, App Engine added Push to Deploy features: https://developers.google.com/appengine/docs/push-to-deploy
It only has built in support for GitHub, but it might still be possible to configure BitBucket to work with it.

This application does not exist (app_id=xxx)

I was unable to upload to an AppEngine as appcfg was telling me :
This application does not exist (app_id=u'xxx').
I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
The fix I found was to add the parameter --no_cookies:
appcfg.py update --no_cookies MyProjectDirectory/
This can happen when you upload AppEngine applications from different Google accounts on the same computer.
You have to log in in your gae account and create an application before you upload it, and your app_id has to have the same name as you app. You can't just upload it.
So go here, create your app, for example "example_app" and set the app_id=example_app and everything should work :)
The same problem occurs with the Java/Eclipse plugin version of App Engine. The 404 happens when you're logged in to the wrong Google account from within the plugin. In that case, look at the bottom-left of Eclipse to see what account you're currently using.
Regarding the Python command line updater, if your cookies indicate that you're logged in to a Google account that doesn't have access to the application you're updating, then that would explain why ignoring those cookies by using "appcfg.py update --nocookies" fixes it.
This is really old, so I wouldn't be surprised if this isn't picked up by the poster, but I wanted to ensure that I have a reference for the next time I have the issue.
I had this issue. My problem ended up being that I had not invited the user that I was authenticating as to be a developer on the project. In fact I had just created the user and not even logged on yet.
I logged on to the google infrastructure as the new user, then added the new user as a developer on the application. I was then able to upload the app.
Tried to upload to the app this morning (first time i've tried since Friday) and it just worked (first time...!)
No idea what the issue was as I haven't done any work on this over the weekend so everything should have been the same as it was on Friday.
I got the same error message trying to make the first deployment of a Python Application using a Google Apps account.
In my case the problem was caused by the fact that my 2-way authentication is enabled.
With 2-way authentication enabled you need to generate an authentication password in your Google Account Management Application and use it to do the deployments.
this way worked:
modified the app.yaml to specify the application: some_id
python appcfg.py update ../some_application/server/python
I fixed this problem by editing my app.yaml file to have the correct application name. In the app.yaml file where it says 'application:[insert app name here]', I had to change the [insert app name here] part. I'm not sure why the name was wrong, but I do remember toying around with it before while attempting to fix a different bug. The way I figured out the proper name was to go to my applications in my GAE admin console and look to see what the app's name was there. Hope this helps anyone else that runs into this same problem :)
If you are using --oauth2 make sure that you are logged into the correct account when generating the token.
appcfg.py --no_cookies --oauth2 --email=myemail --noauth_local_webserver update .
I navigated to my app engine directory folder and ran the above command. This deployed it successfully from the command line for me (Mac OSX terminal)--although I still couldn't deploy from app engine launcher. I believe Launcher still thinks I'm running off port 8080. However, running dev_appserver.py --port=11080 .doesn't fix this issue for me-- what ended up solving it was just removing the directory from the app engine launcher then just re-adding it.
What worked for me is to use the project id from the google app engine console instead of the project name in app.yaml
Posting Ric Moore's comment in the selected answer because that is a valid answer and it worked in my case (and hopefully it helps someone else having the same issue spot it quickly).
I have an alternation solution - in the Google App Engine Launcher select from the menu Control > Clear Deployment Credential. Then when you click Deploy it will take you through the auth flow again and you can select the correct account. - Ric Moore
I had this issue and I simply needed to run 'gcloud app create' for this project within the console console. Screenshot
Previously I don't think this step was needed.

Categories

Resources