I'm currently trying to upload my django app to pythonanywhere and i keep running into errors with my wsgi application, it says "sys" is not defined. I have correctly followed all the steps in the manual that pythonanywhere provides, yet it is still not working. I want to know if anyone has successfully uploaded a django app with pythonanywhere and how he/she got it done; or if there are better alternatives i can explore. Thanks. I would be waiting for an answer.
Pythonanywhere advice to set up a virtual environment, in which you install all dependancies. Have you done so?
Problem:
I have a passwords.py that I need to push to Heroku for my app to work, but I cant commit it to my public git repo because then anyone would be able to view my passwords.
The passwords are tokens / secert_key's / other_api_keys to allow my app to authenticate its requests to 3rd party apis. I'm storing them in base64 encoding in the passwords.py, but if I push it to git encoded anyone would easily be able to see the passwords with b64decode().
How can I push my passwords file to Heroku with out including it in my public git repo?
or
How can I securely store my passwords in my public git repo?
What I've tried:
git push only one file to Heroku
Hiding a password in a python script (insecure obfuscation only)
Git pushing single file doesnt seem to be an option. While using any similar method to encode/decode the passwords would only give me a false sense of security. Any ideas on how to solve it? Thanks!
Use environment variables! You can access them from your python scripts, and heroku lets you easily set them for your app.
Here is some information about setting config vars in heroku.
Create a second branch containing the file. Do not track it on your public repository.
Whenever you need to push to heroku, rebase that branch to master and then push that branch to Heroku.
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.
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.
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.